Skip to content

Updated UI for ArgParser options in TrainingTab.vue #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/components/TabTraining.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
<template>
<div class="tab training">
<h1>Training Options</h1>

We are using yaml files to set up the training configuration (see
config.yaml). Additional arguments given to the main script can be parsed
using one of the tools provided below:

<h2>Argument Parser</h2>

<ul>
<li>
<a href="https://docs.python.org/3/library/argparse.html">Argparse</a> -
is a python built-in tool to handle command-line arguments
</li>
</ul>
<FormSelect
:label="argparser.description"
:options="argparser.options"
:saveKey="argparser.name"
:defaultV="argparser.default"
/>
<h2 class="training">Deterministic Training</h2>
<FormCheckbox
:label="deterministic.description"
Expand Down Expand Up @@ -64,6 +83,7 @@ export default {
components: { FormCheckbox, FormInput, FormRadio, FormSelect },
setup() {
const {
argparser,
deterministic,
backend,
torchrun,
Expand All @@ -81,6 +101,7 @@ export default {
})
return {
store,
argparser,
deterministic,
backend,
torchrun,
Expand Down
7 changes: 7 additions & 0 deletions src/metadata/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"training": {
"argparser": {
"name": "argparser",
"type": "array",
"description": "Select the argument parser for training",
"options": ["argparse"],
"default": "argparse"
},
"deterministic": {
"name": "deterministic",
"type": "checkbox",
Expand Down
1 change: 1 addition & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const msg = reactive({
export const default_config = {
template: '',
include_test: false,
argparser: 'argparse',
output_dir: './logs',
log_every_iters: 10,
logger: 'tensorboard',
Expand Down
10 changes: 10 additions & 0 deletions src/templates/template-common/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import logging

#::: if ((it.argparser == 'argparse')) { :::#
from argparse import ArgumentParser

#::: } :::#
from datetime import datetime
from logging import Logger
from pathlib import Path
Expand Down Expand Up @@ -37,6 +41,9 @@
from omegaconf import DictConfig, OmegaConf


#::: if ((it.argparser == 'argparse')) { :::#


def get_default_parser():
parser = ArgumentParser()
parser.add_argument("config", type=Path, help="Config file path")
Expand Down Expand Up @@ -64,6 +71,9 @@ def setup_config(parser=None):
return DictConfig(config)


#::: } :::#


def log_metrics(engine: Engine, tag: str) -> None:
"""Log `engine.state.metrics` with given `engine` and `tag`.

Expand Down