-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sampler in server configuration (#33)
* Update sampler in server configuration * Add minimalist_demo.py to examples * Update server configuration in minimalist_demo.py * 📝 add minimalist_demo.py * fix to max_token limit --------- Co-authored-by: clementou <[email protected]>
- Loading branch information
Showing
5 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This demo servers as a minimal example of how to use the sotopia library. | ||
|
||
# 1. Import the sotopia library | ||
# 1.1. Import the `run_async_server` function: In sotopia, we use Python Async | ||
# API to optimize the throughput. | ||
import asyncio | ||
|
||
# 1.2. Import the `UniformSampler` class: In sotopia, we use samplers to sample | ||
# the social tasks. | ||
from sotopia.samplers import UniformSampler | ||
from sotopia.server import run_async_server | ||
|
||
# 2. Run the server | ||
asyncio.run( | ||
run_async_server( | ||
model_dict={ | ||
"env": "gpt-4", | ||
"agent1": "gpt-3.5-turbo", | ||
"agent2": "gpt-3.5-turbo", | ||
}, | ||
sampler=UniformSampler(), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from __gin__ import dynamic_registration | ||
import __main__ as train_script | ||
import sotopia.server as server | ||
import sotopia.samplers as samplers | ||
|
||
ACTION_ORDER="round-robin" | ||
TAG=None | ||
|
@@ -14,3 +15,4 @@ server.run_async_server: | |
using_async=True | ||
tag=%TAG | ||
omniscient=%OMNISCIENT | ||
[email protected]() |