Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup everything for sotopia in one script #122

Merged
merged 45 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
00ccc66
git ignore
ProKil May 22, 2024
844e347
add nextra site
ProKil May 22, 2024
0efe3eb
change path to docs
ProKil May 22, 2024
fc9d110
Add installation instruction (#76)
ProKil May 23, 2024
ccdb4d8
fix an accordion bug
ProKil May 23, 2024
ce78c03
Add tabs for choosing platform in Redis Instructions
ProKil May 23, 2024
960dda2
add platform tab
ProKil Jun 7, 2024
7d37baa
Merge remote-tracking branch 'origin/main' into doc/install-instructions
ProKil Jun 7, 2024
aa75d30
updated open in colab instruction
ProKil Jun 7, 2024
6a92459
add agents.md/environments.md rename all_the_issues to troubleshooting
ProKil Jun 17, 2024
e753eb1
Merge branch 'doc/install-instructions' into dev
ProKil Jun 18, 2024
8e51c0d
Merge branch 'dev' into docs/agent-and-environment
ProKil Jun 18, 2024
aed0e37
Merge remote-tracking branch 'origin/main' into feature/auto-setup-sc…
ProKil Jun 21, 2024
3c86bb6
add auto set script
ProKil Jun 21, 2024
331e7d5
add more dataset choices
XuhuiZhou Jun 22, 2024
2c046a1
adding download data menu and protection when the path exists
ProKil Jun 22, 2024
631bfac
Unify benchmark and install into `sotopia` cli command
ProKil Jun 23, 2024
c5d110a
move install and benchmark in to folders
ProKil Jun 23, 2024
134c0a4
make flow more rigorious and add tests
ProKil Jun 24, 2024
83e1cbe
update linux direction
ProKil Jun 24, 2024
94fbf1d
add restart directions
ProKil Jun 24, 2024
036749d
remove _renderer
ProKil Jun 24, 2024
bedb16c
add use docker test
ProKil Jun 24, 2024
283a14b
call -> run
ProKil Jun 24, 2024
1cbb973
add shell=True
ProKil Jun 24, 2024
3bf5958
mkdir when the dirctory doesn't exist
ProKil Jun 24, 2024
b8b72db
remove docker test due to memory limit
ProKil Jun 24, 2024
ddc44c1
add prompt mocking
ProKil Jun 24, 2024
74c7722
add install cli
ProKil Jun 24, 2024
66fde95
add a sleep to make sure that the redis is launched before stopping
ProKil Jun 24, 2024
4abf589
add matrix os in pytest
ProKil Jun 24, 2024
bd25acb
Merge branch 'feature/auto-setup-script' of github.com:sotopia-lab/so…
ProKil Jun 24, 2024
b5001ff
add poetry to path on macos
ProKil Jun 24, 2024
77f0a94
Use install poetry action
ProKil Jun 24, 2024
95a1412
make redis directory on mac
ProKil Jun 24, 2024
a11bc16
avoid permission issue on mac
ProKil Jun 24, 2024
57782a6
update macos test
ProKil Jun 24, 2024
9bd640a
test docker
ProKil Jun 24, 2024
3c466db
install docker with brew
ProKil Jun 24, 2024
cdf95a2
set up docker
ProKil Jun 24, 2024
6bf0cd5
give up testing docker on mac
ProKil Jun 24, 2024
fc5d95e
check if docker daemon is up and brew update
ruiyiw Jun 25, 2024
1ae5b18
Merge remote-tracking branch 'origin/main' into feature/auto-setup-sc…
ProKil Jun 25, 2024
79b2479
improve prompts
ProKil Jun 25, 2024
a88c911
update prompt tests
ProKil Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@ on:

jobs:
Pytest:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
os: [ubuntu-latest, macos-13]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.2
- name: Set up Docker
if: runner.os == 'ubuntu-latest'
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 12
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3
poetry lock
poetry install --with test -E chat
- name: Test with pytest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ backup/*
node_modules/*
docs/.next/*
docs/node_modules/*

redis-data/*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ For some experiments, TogetherAI key is required to run the code. Please set the
conda env config vars set TOGETHER_API_KEY=your_key
```

A redis-stack server is required to run the code. Please follow the [instruction](https://redis.io/docs/stack/get-started/install/docker/) to start a redis-stack server or use an existing server. You can also check [Q&A](/docs/all_the_issues.md) to initiate the redis server with the Sotopia data.
A redis-stack server is required to run the code. Please follow the [instruction](https://redis.io/docs/stack/get-started/install/docker/) to start a redis-stack server or use an existing server. You can also check [Q&A](/docs/troubleshooting.md) to initiate the redis server with the Sotopia data.

The `REDIS_OM_URL` need to be set before loading and saving agents:
```bash
Expand Down Expand Up @@ -156,7 +156,7 @@ To run a large batch of environments, you can change the `ENV_IDS` parameter in
## Getting access to your simulation
After running experiments, you can go to the `examples/redis_stats.ipynb` notebook to check the existing episodes (Episode Log section), as well as calculate the performance.

For the original Sotopia simulation in our paper's experiments, you can find how to get them in the [Q&A](/docs/all_the_issues.md) section in the `./docs` folder.
For the original Sotopia simulation in our paper's experiments, you can find how to get them in the [Q&A](/docs/troubleshooting.md) section in the `./docs` folder.

## Adding new characters and environments
You can use the following function with the `**kwargs` being the properties of the `AgentProfile` class. This is the same for the scenarios/environments.
Expand Down
8 changes: 8 additions & 0 deletions docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
"title": "Documentation",
"type": "menu",
"items": {
"agents": {
"title": "Agents",
"href": "/agents"
},
"environments": {
"title": "Environments",
"href": "/environments"
},
"examples": {
"title": "Examples",
"href": "/examples"
Expand Down
Empty file added docs/pages/agents.md
Empty file.
Empty file added docs/pages/environments.md
Empty file.
2 changes: 1 addition & 1 deletion docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Redis stack is a required dependency for using Sotopia. There are two ways to se
<AccordionItem value="item-1">
<AccordionTrigger>Docker is my thing.</AccordionTrigger>
<AccordionContent>
Please follow the [instruction](https://redis.io/docs/stack/get-started/install/docker/) to start a redis-stack server or use an existing server. You can also check [Q&A](/docs/all_the_issues.md) to initiate the redis server with the Sotopia data.
Please follow the [instruction](https://redis.io/docs/stack/get-started/install/docker/) to start a redis-stack server or use an existing server. You can also check [Q&A](/docs/troubleshooting.md) to initiate the redis server with the Sotopia data.

The `REDIS_OM_URL` need to be set before loading and saving agents:
```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Q&A
# Troubleshooting
## Missing episodes

Large batch size may cause some episodes to be skipped. This is due to the fact that the server may not be able to handle the load. Try reducing the batch size. But you can also use the script in `examples/fix_missing_episodes.py` to fix the missing episodes.
Expand Down
573 changes: 306 additions & 267 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ langchain = "~0.2.5"
rich = "^13.6.0"
PettingZoo = "1.24.3"
redis-om = "^0.2.1"
types-tqdm = "*"
gin-config = "^0.5.0"
absl-py = "^2.0.0"
together = "^0.2.4"
Expand All @@ -42,6 +41,8 @@ pandas = { version = "^2.1.1", optional = true }
pre-commit = "*"
nbmake = "*"
types-setuptools = "*"
types-requests = "*"
types-tqdm = "*"
ruff = "*"

[tool.poetry.group.test.dependencies]
Expand Down Expand Up @@ -79,4 +80,4 @@ testpaths = ["tests"]
python_files = "test_*.py"

[tool.poetry.scripts]
sotopia_benchmark = "sotopia.benchmark:app"
sotopia = "sotopia.cli:app"
3 changes: 0 additions & 3 deletions sotopia/benchmark/__init__.py

This file was deleted.

5 changes: 5 additions & 0 deletions sotopia/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .app import app
from .install import install
from .benchmark import benchmark

__all__ = ["app", "install", "benchmark"]
3 changes: 3 additions & 0 deletions sotopia/cli/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from typer import Typer

app = Typer()
3 changes: 3 additions & 0 deletions sotopia/cli/benchmark/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .benchmark import benchmark

__all__ = ["benchmark"]
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

import typer
from pathlib import Path

app = typer.Typer()
from ..app import app


def check_existing_episodes(
Expand Down Expand Up @@ -264,7 +263,7 @@ def _set_up_logs(


@app.command()
def cli(
def benchmark(
model: str = typer.Option(..., help="The language model you want to benchmark."),
partner_model: str = typer.Option(
"together_ai/meta-llama/Llama-3-70b-chat-hf",
Expand Down Expand Up @@ -297,7 +296,3 @@ def cli(
verbose=False,
push_to_db=True,
)


if __name__ == "__main__":
app()
3 changes: 3 additions & 0 deletions sotopia/cli/install/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .install import install

__all__ = ["install"]
Loading
Loading