mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 09:46:24 +02:00
Update
This commit is contained in:
parent
6a84a9d49b
commit
8dfe2de34c
3 changed files with 73 additions and 51 deletions
48
optimize.py
48
optimize.py
|
|
@ -3,43 +3,41 @@
|
|||
# @Author : didi
|
||||
# @Desc : Experiment of graph optimization
|
||||
|
||||
from examples.ags.w_action_node.optimizer import Optimizer
|
||||
from examples.ags.scripts.optimizer import Optimizer
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
|
||||
# 配置实验参数
|
||||
dataset = "Gsm8K" # 数据集选择为GSM8K
|
||||
sample = 6 # 采样数量
|
||||
q_type = "math" # 问题类型为数学
|
||||
optimized_path = "examples/ags/w_action_node/optimized" # 优化结果保存路径
|
||||
|
||||
# 初始化LLM模型
|
||||
deepseek_llm_config = ModelsConfig.default().get("deepseek-coder")
|
||||
# Crucial Parameters
|
||||
dataset = "HumanEval" # DatasetType
|
||||
sample = 4 # Sample Count, which means how many workflows will be resampled from generated workflows
|
||||
question_type = "code" # Question Type
|
||||
optimized_path = "examples/ags/scripts/optimized" # Optimized Result Save Path
|
||||
|
||||
# Initialize LLM Model
|
||||
mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")
|
||||
claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")
|
||||
# claude_llm_config = ModelsConfig.default().get("deepseek-coder")
|
||||
# 初始化操作符列表
|
||||
gsm8k_operators = [
|
||||
|
||||
# Initialize Operators List
|
||||
operators = [
|
||||
"Custom",
|
||||
"Generate",
|
||||
"ContextualGenerate",
|
||||
"Format",
|
||||
"Review",
|
||||
"Revise",
|
||||
"FuEnsemble",
|
||||
"MdEnsemble",
|
||||
"CustomCodeGenerate",
|
||||
"ScEnsemble",
|
||||
"Rephrase",
|
||||
"Test",
|
||||
]
|
||||
|
||||
# 创建优化器实例
|
||||
# Create an optimizer instance
|
||||
optimizer = Optimizer(
|
||||
dataset=dataset,
|
||||
opt_llm_config=claude_llm_config,
|
||||
exec_llm_config=deepseek_llm_config,
|
||||
operators=gsm8k_operators,
|
||||
exec_llm_config=mini_llm_config,
|
||||
operators=operators,
|
||||
optimized_path=optimized_path,
|
||||
sample=sample,
|
||||
q_type=q_type,
|
||||
question_type=question_type,
|
||||
)
|
||||
|
||||
# 运行优化器
|
||||
optimizer.optimize("Operator")
|
||||
# Run the optimizer
|
||||
optimizer.optimize("Graph", 10)
|
||||
# optimizer.optimize("Graph")
|
||||
# optimizer.optimize("Operator")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue