Skip to content

Commit

Permalink
update_get_result_web
Browse files Browse the repository at this point in the history
  • Loading branch information
xingzhongyu committed Sep 19, 2024
1 parent 04a3a4b commit ab7e193
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions get_result_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from dance.utils import try_import

# os.environ["http_proxy"]="http://121.250.209.147:7890"
# os.environ["https_proxy"]="http://121.250.209.147:7890"
os.environ["http_proxy"] = "http://121.250.209.147:7890"
os.environ["https_proxy"] = "http://121.250.209.147:7890"
wandb = try_import("wandb")
entity = "xzy11632"
project = "dance-dev"
Expand Down Expand Up @@ -55,13 +55,16 @@ def check_identical_strings(string_list):
# if s != first_string:
# raise ValueError(f"发现不同的字符串: '{first_string}' 和 '{s}'")
# return first_string
def get_sweep_url(step_csv: pd.DataFrame):
def get_sweep_url(step_csv: pd.DataFrame, single=True):
ids = step_csv["id"]
sweep_urls = []
for run_id in tqdm(ids, leave=False):
for run_id in tqdm(reversed(ids),
leave=False): #The reversal of order is related to additional_sweep_ids.append(sweep_id)
api = wandb.Api()
run = api.run(f"/{entity}/{project}/runs/{run_id}")
sweep_urls.append(run.sweep.url)
if single:
break
sweep_url = check_identical_strings(sweep_urls)
return sweep_url

Expand All @@ -74,7 +77,11 @@ def write_ans():
step2_url = get_sweep_url(pd.read_csv(f"{file_path}/pipeline/best_test_acc.csv"))
step3_urls = []
for i in range(3):
step3_urls.append(get_sweep_url(pd.read_csv(f"{file_path}/params/{i}_best_test_acc.csv")))
file_csv = f"{file_path}/params/{i}_best_test_acc.csv"
if not os.path.exists(file_csv):
print(f"文件 {file_csv} 不存在,跳过。")
continue
step3_urls.append(get_sweep_url(pd.read_csv(file_csv)))
step3_str = ",".join(step3_urls)
step_str = f"step2:{step2_url}|step3:{step3_str}"
ans.append({"Dataset_id": dataset_id, method_folder: step_str})
Expand Down

0 comments on commit ab7e193

Please sign in to comment.