Skip to content

Commit

Permalink
[IMP] improved test script to accommodate new runs
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecinspace committed Nov 15, 2023
1 parent f5705c1 commit 848f7c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ Launch the training !
./run train
```

### Other

- NLP is used in the Flickr30K script in order to extract good annotations from captions, run this for it to work :
## Download and test models

```
python -m spacy download en_core_web_sm
python src/download.py ml.wandb.project=your-project ml.wandb.download.download=true ml.wandb.download.list_all=true
python src/test.py
```
19 changes: 15 additions & 4 deletions src/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def main(cfg: DictConfig) -> None:

results_file = folder / "results.csv"

if not os.path.isfile(results_file):
weights = get_weights(folder, project)
runs_info = build_runs_info(folder, project, weights)
else:

weights = get_weights(folder, project)
new_runs_info = build_runs_info(folder, project, weights)

if os.path.isfile(results_file):
# read older runs
with open(results_file, mode='r') as csv_file:
reader = csv.DictReader(csv_file)
Expand All @@ -102,6 +103,16 @@ def main(cfg: DictConfig) -> None:
# Append each row as a dictionary to the list
runs_info.append(row)

ids = [r['run_id'] for r in runs_info]

for run in new_runs_info:
if run['run_id'] not in ids:
runs_info += [run]

else:
runs_info = new_runs_info


# create yaml test file
test_yaml_file = test_path / 'data.yaml'
create_yaml_file(test_yaml_file, test_path, test_path, test_path)
Expand Down

0 comments on commit 848f7c1

Please sign in to comment.