MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / _run

Function _run

SWF/src/run.py:100–167  ·  view source on GitHub ↗
(args, data)

Source from the content-addressed store, hash-verified

98]
99
100def _run(args, data):
101
102 if args.persona == 'must fair with penalty':
103 system_prompt = CORE_SYSTEM_GENERAL_PROMPT_MUST_FAIR_PENTALTY
104 input_prompt = CORE_INSTRUCTIONS_GENERAL_PROCESS
105 elif args.persona == 'must fair with benefit':
106 system_prompt = CORE_SYSTEM_GENERAL_PROMPT_MUST_FAIR_BENEFIT
107 input_prompt = CORE_INSTRUCTIONS_GENERAL_PROCESS
108 elif args.persona == 'general identification':
109 system_prompt = CORE_SYSTEM_GENERAL_PROMPT_IDENTIFICATION
110 input_prompt = CORE_INSTRUCTIONS_GENERAL_PROCESS
111 elif args.persona == 'general internalization':
112 system_prompt = CORE_SYSTEM_GENERAL_PROMPT_INTERNALIZATION
113 input_prompt = CORE_INSTRUCTIONS_GENERAL_PROCESS
114 else:
115 if args.remove:
116 system_prompt = CORE_SYSTEM_GENERAL_PROMPT_W_REMOVE
117 else:
118 system_prompt = CORE_SYSTEM_GENERAL_PROMPT
119 input_prompt = CORE_INSTRUCTIONS_GENERAL_PROCESS
120
121 recipients = [Agent(DOCUMENTATIONS[model]) for model in team]
122 model_config = {
123 "model_name": args.model_name,
124 "base_url": args.base_url,
125 "api_key": args.api_key,
126 }
127
128 allocator = StreamOrdinator(
129 system=system_prompt,
130 inputs=input_prompt,
131 model_config=model_config,
132 max_timesteps=1000,
133 max_retry=10,
134 )
135
136 env = CacheEnv(
137 core=allocator,
138 agents=recipients,
139 output_dir=args.output_dir,
140 max_turns=args.max_turns,
141 budget=100,
142 prefix='TASK',
143 remove=args.remove,
144 HP=args.hp if args.hp != -1 else len(recipients) - 1,
145 cache_file='../env/cache_tasks.12982.json',
146 )
147
148 bar = tqdm(data)
149
150 for _, batch in enumerate(bar):
151 batch['config'] = vars(args)
152 tasks = [
153 Task(type=line['type'],
154 raw=line['problem'] + f" (difficulty: {line['difficulty']} / {len(team)})",
155 content=line['problem'] + f" (difficulty: {line['difficulty']} / {len(team)})",
156 ground_turth=line['solution'],
157 task_id=line['task_id'],

Callers 1

mainFunction · 0.85

Calls 6

runMethod · 0.95
AgentClass · 0.90
CacheEnvClass · 0.90
TaskClass · 0.90
StreamOrdinatorClass · 0.85
write_fileMethod · 0.80

Tested by

no test coverage detected