mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
1. role.py - 如果已经有plan,便不再重复生成
2. 修改prompt,让predictions.csv生成的格式与原gt格式一样
This commit is contained in:
parent
0e5db1c364
commit
f28908e4c5
5 changed files with 14 additions and 11 deletions
|
|
@ -42,6 +42,7 @@ class Node():
|
|||
value : float = 0
|
||||
visited : int = 0
|
||||
children : list = []
|
||||
normalized_reward : dict = {"train_score": 0, "dev_score": 0, "test_score": 0}
|
||||
parent = None
|
||||
|
||||
def __init__(self, parent=None, state = None, action=None, value = 0, max_depth=4, **kwargs):
|
||||
|
|
@ -274,7 +275,7 @@ class MCTS():
|
|||
if score > best_score:
|
||||
best_score = score
|
||||
best_child = child
|
||||
best_score, best_child = bfs(child, best_score, best_child)
|
||||
best_score, best_child = bfs(child, best_score, best_child, split)
|
||||
return best_score, best_child
|
||||
_, best_child = bfs(root, best_score, best_child, "test_score")
|
||||
_, dev_best_child = bfs(root, best_score, best_child, "dev_score")
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@ TASK_PROMPT = """\
|
|||
3. You should perform transformations on all sets at the same step.
|
||||
|
||||
## Saving Dev and Test Predictions
|
||||
Save the prediction results of BOTH the dev set and test set in `dev_predictions.csv` and `test_predictions.csv` respectively in the output directory.
|
||||
Both files should contain a single column named `target` with the predicted values.
|
||||
Make sure the prediction results are in the same format as the target column in the training set. The labels should be transformed back to the original format if any transformation was applied during training.
|
||||
1. Save the prediction results of BOTH the dev set and test set in `dev_predictions.csv` and `test_predictions.csv` respectively in the output directory.
|
||||
- Both files should contain a single column named `target` with the predicted values.
|
||||
2. Make sure the prediction results are in the same format as the target column in the training set.
|
||||
- The labels should be transformed back to the original format if any transformation was applied during training.
|
||||
- If the original target column was categorical, the predictions should be in the same format.
|
||||
|
||||
## Output Training Set Performance
|
||||
Make sure the performance of the model is printed in python in the last step even if it has been printed in the previous steps. The value should be a float number.
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class AugExperimenter(Experimenter):
|
|||
"score_dict": score_dict,
|
||||
"aug_mode": self.args.aug_mode,
|
||||
"insights" : exps[i],
|
||||
"user_requirement": user_requirement,
|
||||
"user_requirement": requirement,
|
||||
"args": vars(self.args)
|
||||
})
|
||||
scores = [result["score_dict"]["test_score"] for result in results]
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ class MCTSExperimenter(Experimenter):
|
|||
self.save_tree(text)
|
||||
|
||||
results = {
|
||||
"best_node": best_node,
|
||||
"best_node": best_node.id,
|
||||
"best_node_score": best_node.raw_reward,
|
||||
"dev_best_node": dev_best_node,
|
||||
"dev_best_node": dev_best_node.id,
|
||||
"dev_best_node_score": dev_best_node.raw_reward,
|
||||
"num_generated_codes": num_generated_codes,
|
||||
"user_requirement": best_node.state["requirement"],
|
||||
|
|
|
|||
|
|
@ -478,10 +478,10 @@ class Role(SerializationMixin, ContextMixin, BaseModel):
|
|||
|
||||
async def _plan_and_act(self) -> Message:
|
||||
"""first plan, then execute an action sequence, i.e. _think (of a plan) -> _act -> _act -> ... Use llm to come up with the plan dynamically."""
|
||||
|
||||
# create initial plan and update it until confirmation
|
||||
goal = self.rc.memory.get()[-1].content # retreive latest user requirement
|
||||
await self.planner.update_plan(goal=goal)
|
||||
if not self.planner.plan.goal:
|
||||
# create initial plan and update it until confirmation
|
||||
goal = self.rc.memory.get()[-1].content # retreive latest user requirement
|
||||
await self.planner.update_plan(goal=goal)
|
||||
|
||||
# take on tasks until all finished
|
||||
while self.planner.current_task:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue