Skip to content

Commit fb550a3

Browse files
authored
Add support for YAML, TOML & JSON (#182)
1 parent bf48733 commit fb550a3

File tree

14 files changed

+3966
-658
lines changed

14 files changed

+3966
-658
lines changed

docs/source/guides/cli.md

Lines changed: 396 additions & 0 deletions
Large diffs are not rendered by default.

examples/entrypoint/task.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,16 @@ def train_model(
6969
print("Training completed!")
7070

7171

72+
@run.cli.factory(target=train_model)
73+
def train_recipe() -> run.Partial[train_model]:
74+
return run.Partial(
75+
train_model,
76+
model=my_model(hidden_size=512),
77+
optimizer=my_optimizer(learning_rate=0.0005),
78+
epochs=50,
79+
batch_size=2048,
80+
)
81+
82+
7283
if __name__ == "__main__":
7384
run.cli.main(train_model, cmd_defaults={"skip_confirmation": True})

examples/entrypoint/test.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
_partial_ = true
2+
_target_ = "__main__.train_model"
3+
batch_size = 32
4+
epochs = 10
5+
6+
[model]
7+
_target_ = "__main__.Model"
8+
activation = "relu"
9+
hidden_size = 256
10+
num_layers = 5
11+
12+
[optimizer]
13+
_target_ = "__main__.Optimizer"
14+
betas = [ 0.9, 0.999,]
15+
learning_rate = 0.001
16+
weight_decay = 1e-5

nemo_run/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from nemo_run.core.tunnel.client import LocalTunnel, SSHTunnel
2727
from nemo_run.devspace.base import DevSpace
2828
from nemo_run.help import help
29-
from nemo_run.lazy import LazyEntrypoint, lazy_imports
29+
from nemo_run.cli.lazy import LazyEntrypoint, lazy_imports
3030
from nemo_run.package_info import __package_name__, __version__
3131
from nemo_run.run.api import run
3232
from nemo_run.run.experiment import Experiment

0 commit comments

Comments
 (0)