From acd0ee04a8d83dc8d3f1bf01c6d3869d072b700b Mon Sep 17 00:00:00 2001 From: yiyiyi0817 <1359513271@qq.com> Date: Mon, 18 Nov 2024 20:17:09 +0800 Subject: [PATCH] fix format --- README.md | 3 ++- oasis/social_agent/agents_generator.py | 2 +- oasis/social_platform/recsys.py | 5 +++-- scripts/twitter_gpt_example/gpt_example.yaml | 2 +- scripts/twitter_gpt_example/twitter_simulation_large.py | 6 ++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b85d4d3..f612bb9 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,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 approximately 14 API requests to call gpt-4, and the cost incurred is minimal. (October 29, 2024) ## 📘 Comprehensive Guide (For Open Source Models) diff --git a/oasis/social_agent/agents_generator.py b/oasis/social_agent/agents_generator.py index 81bb54a..eefc08b 100644 --- a/oasis/social_agent/agents_generator.py +++ b/oasis/social_agent/agents_generator.py @@ -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) diff --git a/oasis/social_platform/recsys.py b/oasis/social_platform/recsys.py index f2a9609..cda83eb 100644 --- a/oasis/social_platform/recsys.py +++ b/oasis/social_platform/recsys.py @@ -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: diff --git a/scripts/twitter_gpt_example/gpt_example.yaml b/scripts/twitter_gpt_example/gpt_example.yaml index f0ec138..79e002e 100644 --- a/scripts/twitter_gpt_example/gpt_example.yaml +++ b/scripts/twitter_gpt_example/gpt_example.yaml @@ -18,4 +18,4 @@ model: temperature: null inference: model_type: gpt-4o-mini # Name of the OpenAI model - is_openai_model: true # Whether it is an OpenAI model \ No newline at end of file + is_openai_model: true # Whether it is an OpenAI model diff --git a/scripts/twitter_gpt_example/twitter_simulation_large.py b/scripts/twitter_gpt_example/twitter_simulation_large.py index 54f63da..5e105f6 100644 --- a/scripts/twitter_gpt_example/twitter_simulation_large.py +++ b/scripts/twitter_gpt_example/twitter_simulation_large.py @@ -27,7 +27,6 @@ from yaml import safe_load 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 @@ -179,9 +178,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.")