Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/camel-ai/oasis into twitter…
Browse files Browse the repository at this point in the history
…_simu
  • Loading branch information
Redtides0 committed Nov 30, 2024
2 parents b53bd79 + 15d2f96 commit ef761c0
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 83 deletions.
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![arXiv][arxiv-image]][arxiv-url]
[![Python Version][python-image]][python-url]
[![PyTest Status][pytest-image]][pytest-url]
[![Star][star-image]][star-url]
[![Slack][slack-image]][slack-url]
[![Discord][discord-image]][discord-url]
Expand All @@ -8,18 +8,19 @@

______________________________________________________________________

# OASIS: Open Agents Social Interaction Simulations on a Large Scale
# OASIS: Open Agent Social Interaction Simulations with One Million Agents

<p align="center">
<img src='assets/logo.jpg' width=400>
</p>

<p align="center">
<a href="https://github.com/camel-ai/camel#community">Community</a> |
<a href="https://github.com/camel-ai/social-simulation/tree/main/scripts">Examples</a> |
<a href="https://arxiv.org/abs/2411.11581">Paper</a> |
<a href="https://github.com/camel-ai/oasis/tree/main/scripts">Examples</a> |
<a href="https://huggingface.co/datasets/oasis-agent/oasis-dataset">Dataset</a> |
<a href="https://github.com/camel-ai/camel#citation">Citation</a> |
<a href="https://github.com/camel-ai/camel#contributing-to-camel-">Contributing</a> |
<a href="https://github.com/camel-ai/oasis#-citation">Citation</a> |
<a href="https://github.com/camel-ai/oasis#-contributing-to-oasis">Contributing</a> |
<a href="https://www.camel-ai.org/">CAMEL-AI</a>
</p>

Expand Down Expand Up @@ -126,11 +127,12 @@ To import your own user and post data, please refer to the JSON file format loca
```bash
# For Reddit
python scripts/reddit_gpt_example/reddit_simulation_gpt.py --config_path scripts/reddit_gpt_example/gpt_example.yaml

# For Twitter
python scripts/twitter_gpt_example/twitter_simulation_large.py --config_path scripts/twitter_gpt_example/gpt_example.yaml
```

Note: without modifying the Configuration File, running this script requires approximately 14 API requests to call gpt-4, and the cost incurred is minimal. (October 29, 2024)
Note: without modifying the Configuration File, running the Reddit script requires only 36 agents operating at an activation probability of 0.1 for 2 time steps, the entire process approximately requires 7.2 agent inferences, and approximately 14 API requests to call GPT-4. The Twitter script has about 111 agents operating at an activation probability of roughly 0.1 for 3 time steps, i.e., 33.3 agent inferences, using GPT-3.5-turbo. I hope this is a cost you can bear. For running larger scale agent simulations, it is recommended to read the next section on experimenting with open-source models.

## 📘 Comprehensive Guide (For Open Source Models)

Expand Down Expand Up @@ -296,11 +298,22 @@ To discover how to create profiles for large-scale users, as well as how to visu

<!-- - Public release of our dataset on Hugging Face (November 05, 2024) -->

- Initial release of OASIS github repository (November 15, 2024)
- Initial release of OASIS on arXiv (November 19, 2024)
- Initial release of OASIS github repository (November 19, 2024)

## 🔗 Citation

To be supplemented after the release on arXiv.
```
@misc{yang2024oasisopenagentsocial,
title={OASIS: Open Agent Social Interaction Simulations with One Million Agents},
author={Ziyi Yang and Zaibin Zhang and Zirui Zheng and Yuxian Jiang and Ziyue Gan and Zhiyu Wang and Zijian Ling and Jinsong Chen and Martz Ma and Bowen Dong and Prateek Gupta and Shuyue Hu and Zhenfei Yin and Guohao Li and Xu Jia and Lijun Wang and Bernard Ghanem and Huchuan Lu and Chaochao Lu and Wanli Ouyang and Yu Qiao and Philip Torr and Jing Shao},
year={2024},
eprint={2411.11581},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2411.11581},
}
```
## 🙌 Acknowledgment
Expand All @@ -310,7 +323,7 @@ We would like to thank Douglas for designing the logo of our project.
The source code is licensed under Apache 2.0.
## 🥂 Contributing to OASIS 🏝️
## 🥂 Contributing to OASIS🏝️
We greatly appreciate your interest in contributing to our open-source initiative. To ensure a smooth collaboration and the success of contributions, we adhere to a set of contributing guidelines similar to those established by CAMEL. For a comprehensive understanding of the steps involved in contributing to our project, please refer to the CAMEL contributing guidelines [here](https://github.com/camel-ai/camel/blob/master/CONTRIBUTING.md). 🤝🚀
Expand All @@ -320,16 +333,16 @@ An essential part of contributing involves not only submitting new features with
If you're keen on exploring new research opportunities or discoveries with our platform and wish to dive deeper or suggest new features, we're here to talk. Feel free to get in touch for more details at camel.ai.team@gmail.com.
[arxiv-image]: https://img.shields.io/badge/arXiv-2407.01511-b31b1b.svg
[arxiv-url]: https://arxiv.org/abs/2411.11581
[discord-image]: https://img.shields.io/badge/Discord-CAMEL--AI-7289da?logo=discord&logoColor=white&color=7289da
[discord-url]: https://discord.gg/CNcNpquyDc
[pytest-image]: https://github.com/camel-ai/camel/actions/workflows/pytest_package.yml/badge.svg
[pytest-url]: https://github.com/camel-ai/social-simulation/actions/workflows/pytest_package.yml
[python-image]: https://img.shields.io/badge/Python-3.10%2B-brightgreen.svg
[python-url]: https://docs.python.org/3.10/
[slack-image]: https://img.shields.io/badge/Slack-CAMEL--AI-blueviolet?logo=slack
[slack-url]: https://join.slack.com/t/camel-kwr1314/shared_invite/zt-1vy8u9lbo-ZQmhIAyWSEfSwLCl2r2eKA
[star-image]: https://img.shields.io/github/stars/camel-ai/social-simulation?label=stars&logo=github&color=brightgreen
[star-url]: https://github.com/camel-ai/social-simulation/stargazers
[star-image]: https://img.shields.io/github/stars/camel-ai/oasis?label=stars&logo=github&color=brightgreen
[star-url]: https://github.com/camel-ai/oasis/stargazers
[twitter-image]: https://img.shields.io/twitter/follow/CamelAIOrg?style=social&color=brightgreen&logo=twitter
[twitter-url]: https://twitter.com/CamelAIOrg
[wechat-image]: https://img.shields.io/badge/WeChat-CamelAIOrg-brightgreen?logo=wechat&logoColor=white
Expand Down
Binary file modified assets/intro-new-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion oasis/social_agent/agents_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class instances.
model_type=model_type,
agent_graph=agent_graph,
action_space_prompt=action_space_prompt,
is_openai_model = is_openai_model,
is_openai_model=is_openai_model,
)

agent_graph.add_agent(agent)
Expand Down
5 changes: 3 additions & 2 deletions oasis/social_platform/recsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,9 @@ def rec_sys_personalized_twh(
ActionType.LIKE_POST.value,
trace_table)
like_post_ids_all.append(like_post_ids)
# enable fans_score when the broadcasting effect of superuser should be taken in count
# ßscores = date_score_np * fans_score_np
# enable fans_score when the broadcasting effect of superuser should be
# taken in count
# ßscores = date_score_np * fans_score_np
scores = date_score_np
new_rec_matrix = []
if len(post_table) <= max_rec_post_len:
Expand Down
5 changes: 5 additions & 0 deletions scripts/reddit_gpt_example/reddit_simulation_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
# flake8: noqa: E402
from __future__ import annotations

import argparse
Expand All @@ -19,12 +20,16 @@
import logging
import os
import random
import sys
from datetime import datetime, timedelta
from typing import Any

from colorama import Back
from yaml import safe_load

sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))

from oasis.clock.clock import Clock
from oasis.social_agent.agents_generator import (gen_control_agents_with_data,
generate_reddit_agents)
Expand Down
6 changes: 3 additions & 3 deletions scripts/twitter_gpt_example/gpt_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ data:
db_path: data/simu_db/yaml_gpt/False_Business_0.db
csv_path: data/twitter_dataset/anonymous_topic_200_1h/False_Business_0.csv
simulation:
num_timesteps: 10
num_timesteps: 3
clock_factor: 60
recsys_type: twhin-bert
model:
num_agents: 111
model_random_seed: 42
cfgs:
- model_type: gpt-4o-mini
- model_type: gpt-3.5-turbo
num: 111
server_url: null
model_path: null
stop_tokens: null
temperature: null
inference:
model_type: gpt-4o-mini # Name of the OpenAI model
is_openai_model: true # Whether it is an OpenAI model
is_openai_model: true # Whether it is an OpenAI model
11 changes: 7 additions & 4 deletions scripts/twitter_gpt_example/twitter_simulation_large.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
# flake8: noqa: E402
from __future__ import annotations

import argparse
import asyncio
import logging
import os
import random
import sys
from datetime import datetime
from pathlib import Path
from typing import Any
Expand All @@ -26,8 +28,10 @@
from colorama import Back
from yaml import safe_load

sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))

from oasis.clock.clock import Clock
from oasis.inference.inference_manager import InferencerManager
from oasis.social_agent.agents_generator import generate_agents
from oasis.social_platform.channel import Channel
from oasis.social_platform.platform import Platform
Expand Down Expand Up @@ -179,9 +183,8 @@ async def running(
**simulation_params,
model_configs=model_configs,
inference_configs=inference_configs,
action_space_file_path=(
"scripts/twitter_gpt_example/"
"action_space_prompt.txt")))
action_space_file_path=("scripts/twitter_gpt_example/"
"action_space_prompt.txt")))
else:
asyncio.run(running())
social_log.info("Simulation finished.")
Loading

0 comments on commit ef761c0

Please sign in to comment.