Skip to content

CLI entry point

research_tracker.main is the research-tracker console script: it parses arguments and dispatches to the handler for the selected subcommand. The commands are documented one by one, with examples, in CLI.

research_tracker.cli.main()

Source code in src/research_tracker/cli.py
312
313
314
def main():
    args = parse_args()
    args.func(args)

research_tracker.cli.parse_args()

Source code in src/research_tracker/cli.py
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
def parse_args():
    parser = ArgumentParser()

    parser.add_argument(
        "--root",
        "--artifact-root-dir",
        "-o",
        type=Path,
        default=Path.cwd() / "artifacts",
        help="Root dir path for keeping the tracker files",
    )

    method_subparser = parser.add_subparsers(
        dest="method",
        required=True,
        help="Available subcommands",
    )
    _, run_subparser = add_parser_with_common("run", method_subparser)
    add_parser_with_common("evaluation", method_subparser)
    add_parser_with_common("condition", method_subparser)
    add_parser_with_common("metric", method_subparser)
    add_parser_with_common("artifact", method_subparser)
    sync_parser = method_subparser.add_parser(
        "sync",
        help="Synchronize local store with remote",
    )
    sync_parser.add_argument(
        "external_store",
        type=Path,
        help="Path to external store directory",
    )
    sync_parser.add_argument(
        "--skip_copy_artifacts",
        "--skip-copy-artifacts",
        action="store_true",
        help="Skip copying referenced config, checkpoint, and artifact files",
    )
    sync_parser.set_defaults(func=handle_sync)

    migrate_parser = method_subparser.add_parser(
        "migrate",
        help="Upgrade a schema-version-1 Parquet store to the SQLite backend",
    )
    migrate_parser.add_argument(
        "--dry-run",
        "--dry_run",
        action="store_true",
        help="Report what would be written without modifying the store",
    )
    migrate_parser.add_argument(
        "--no-backup",
        "--no_backup",
        action="store_true",
        help="Leave the Parquet files in place instead of moving them to parquet-v1/",
    )
    migrate_parser.set_defaults(func=handle_migrate)

    import_parser = run_subparser.add_parser(
        "import",
        help="Import from wandb",
    )
    import_parser.add_argument(
        "--run_path",
        "--run-path",
        type=str,
        required=True,
        help="Path to wandb run (found in url)",
    )
    import_parser.add_argument(
        "--model",
        type=str,
        required=True,
        help="Model name",
    )
    import_parser.add_argument(
        "--dataset",
        type=str,
        required=True,
        help="Dataset name",
    )
    import_parser.add_argument(
        "--config",
        "--cfg",
        action="append",
        required=True,
        help="List of config files. If multiple, they will be merged.",
    )
    import_parser.add_argument(
        "--checkpoint",
        "--ckpt",
        type=Path,
        required=True,
        help="Path to checkpoint",
    )
    import_parser.add_argument(
        "--dry-run",
        "--dry_run",
        action="store_true",
    )
    import_parser.set_defaults(func=handle_import)

    return parser.parse_args()