MCPcopy Create free account
hub / github.com/pytorch/tutorials / trainer

Function trainer

intermediate_source/ax_multiobjective_nas_tutorial.py:64–99  ·  view source on GitHub ↗
(
    log_path: str,
    hidden_size_1: int,
    hidden_size_2: int,
    learning_rate: float,
    epochs: int,
    dropout: float,
    batch_size: int,
    trial_idx: int = -1,
)

Source from the content-addressed store, hash-verified

62
63
64def trainer(
65 log_path: str,
66 hidden_size_1: int,
67 hidden_size_2: int,
68 learning_rate: float,
69 epochs: int,
70 dropout: float,
71 batch_size: int,
72 trial_idx: int = -1,
73) -> specs.AppDef:
74
75 # define the log path so we can pass it to the TorchX ``AppDef``
76 if trial_idx >= 0:
77 log_path = Path(log_path).joinpath(str(trial_idx)).absolute().as_posix()
78
79 return utils.python(
80 # command line arguments to the training script
81 "--log_path",
82 log_path,
83 "--hidden_size_1",
84 str(hidden_size_1),
85 "--hidden_size_2",
86 str(hidden_size_2),
87 "--learning_rate",
88 str(learning_rate),
89 "--epochs",
90 str(epochs),
91 "--dropout",
92 str(dropout),
93 "--batch_size",
94 str(batch_size),
95 # other config options
96 name="trainer",
97 script="mnist_train_nas.py",
98 image=torchx.version.TORCHX_IMAGE,
99 )
100
101
102######################################################################

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected