mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 15:37:44 +00:00
load code from file dict instead of folder (#641)
Co-authored-by: Xu <v-xuminrui@microsoft.com>
This commit is contained in:
@@ -66,6 +66,7 @@ coverage.xml
|
||||
# Django stuff:
|
||||
*.log
|
||||
/log/
|
||||
log*/
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
@@ -219,6 +219,13 @@ class FBWorkspace(Workspace):
|
||||
relative_path = file_path.relative_to(folder_path)
|
||||
self.inject_files(**{str(relative_path): file_path.read_text()})
|
||||
|
||||
def inject_code_from_file_dict(self, workspace: FBWorkspace) -> None:
|
||||
"""
|
||||
Load the workspace from the file_dict
|
||||
"""
|
||||
for name, code in workspace.file_dict.items():
|
||||
self.inject_files(**{name: code})
|
||||
|
||||
def copy(self) -> FBWorkspace:
|
||||
"""
|
||||
copy the workspace from the original one
|
||||
|
||||
@@ -267,7 +267,8 @@ class DSExpGen(ExpGen):
|
||||
|
||||
exp = DSExperiment(pending_tasks_list=[[task]], hypothesis=DSHypothesis(component))
|
||||
if last_successful_exp:
|
||||
exp.experiment_workspace.inject_code_from_folder(last_successful_exp.experiment_workspace.workspace_path)
|
||||
# exp.experiment_workspace.inject_code_from_folder(last_successful_exp.experiment_workspace.workspace_path)
|
||||
exp.experiment_workspace.inject_code_from_file_dict(last_successful_exp.experiment_workspace)
|
||||
return exp
|
||||
|
||||
def gen(self, trace: DSTrace) -> DSExperiment:
|
||||
@@ -449,7 +450,8 @@ class DSExpGen(ExpGen):
|
||||
hypothesis, task, new_workflow_desc = _f(user_prompt)
|
||||
|
||||
exp = DSExperiment(pending_tasks_list=[[task]], hypothesis=hypothesis)
|
||||
exp.experiment_workspace.inject_code_from_folder(sota_exp.experiment_workspace.workspace_path)
|
||||
# exp.experiment_workspace.inject_code_from_folder(sota_exp.experiment_workspace.workspace_path)
|
||||
exp.experiment_workspace.inject_code_from_file_dict(sota_exp.experiment_workspace)
|
||||
|
||||
if new_workflow_desc != "No update needed":
|
||||
workflow_task = WorkflowTask(
|
||||
|
||||
Reference in New Issue
Block a user