Subprocess improvements (#10973)

* Use list-form arguments for subprocess.run calls where possible

Augments #10944

* Deduplicate curl code

* Avoid eval() to parse integer

---------

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Aarni KoskelaandGlenn Jocher authored and GitHub committed 2023-02-13 18:00:31 +04:00
1 parent 1a2eb532ce
commit a2de5c5bf6
8 files changed
+68 -24

No files matched your search

+6 -2
View File
@@ -598,8 +598,12 @@ def main(opt, callbacks=Callbacks()):
# ei = [isinstance(x, (int, float)) for x in hyp.values()] # evolvable indices
evolve_yaml, evolve_csv = save_dir / 'hyp_evolve.yaml', save_dir / 'evolve.csv'
if opt.bucket:
subprocess.run(
f'gsutil cp gs://{opt.bucket}/evolve.csv {evolve_csv}'.split()) # download evolve.csv if exists
# download evolve.csv if exists
subprocess.run([
'gsutil',
'cp',
f'gs://{opt.bucket}/evolve.csv',
str(evolve_csv),])
for _ in range(opt.evolve): # generations to evolve
if evolve_csv.exists(): # if evolve.csv exists: select best hyps and mutate