mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-22 09:13:01 +00:00
ai pretrain-predict: fix - → _ in cli parsing
This commit is contained in:
parent
f97b771922
commit
1876a8883c
2 changed files with 6 additions and 1 deletions
|
@ -25,7 +25,7 @@ For more information, do src/index.py <subcommand> --help.
|
|||
""")
|
||||
exit(0)
|
||||
|
||||
subcommand = re.sub(r'[^a-z0-9-]', '', sys.argv[1])
|
||||
subcommand = re.sub(r'-', '_', re.sub(r'[^a-z0-9-]', '', sys.argv[1]))
|
||||
|
||||
subcommand_argparser = importlib.import_module(f"subcommands.{subcommand}").parse_args
|
||||
|
||||
|
|
|
@ -68,12 +68,17 @@ def run(args):
|
|||
if filepath_output != "-":
|
||||
handle = io.open(filepath_output, "w")
|
||||
|
||||
i = 0
|
||||
for rainfall, water in ai.embed(dataset):
|
||||
handle.write(json.dumps({
|
||||
"rainfall": rainfall.numpy().tolist(),
|
||||
"water": water.numpy().tolist()
|
||||
}, separators=(',', ':'))+"\n") # Ref https://stackoverflow.com/a/64710892/1460422
|
||||
|
||||
if i == 0 or i % 1000 == 0:
|
||||
sys.stderr.write(f"[pretrain:predict] STEP {i}\r")
|
||||
i += 1
|
||||
|
||||
handle.close()
|
||||
|
||||
sys.stderr.write(">>> Complete\n")
|
Loading…
Reference in a new issue