Skip to content

Commit 744f218

Browse files
committed
fixes to exercises
1 parent 1f0d716 commit 744f218

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

s2_organisation_and_version_control/cli.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,19 @@ for doing this, and of other excellent frameworks for creating command line inte
209209

210210
```bash
211211
python iris_classifier.py train svm --kernel 'linear'
212-
python iris_classifier.py train knn -k 5
212+
python iris_classifier.py train knn --n-neighbors 5
213213
```
214214

215215
e.g the `train` command now has two subcommands for training different machine learning models (in this case SVM
216216
and KNN) which each takes arguments that are unique to that model. Relevant
217217
[documentation](https://typer.tiangolo.com/tutorial/subcommands/).
218218

219+
!!! warning "`_` vs `-`"
220+
221+
When using typer do not that variables with `_` in the name
222+
will be converted to `-` in the CLI. Meaning that if you have a variable `n_neighbors` in your code, you should use
223+
`--n-neighbors` in the CLI.
224+
219225
??? success
220226

221227
```python linenums="1" title="iris_classifier.py"

s2_organisation_and_version_control/exercise_files/typer_exercise_solution3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def svm(kernel: str = "linear", output_file: Annotated[str, typer.Option("--outp
3838

3939

4040
@train_app.command()
41-
def knn(k: int = 5, output_file: Annotated[str, typer.Option("--output", "-o")] = "model.ckpt") -> None:
41+
def knn(n_neighbors: int = 5, output_file: Annotated[str, typer.Option("--output", "-o")] = "model.ckpt") -> None:
4242
"""Train a KNN model."""
43-
model = KNeighborsClassifier(n_neighbors=k)
43+
model = KNeighborsClassifier(n_neighbors=n_neighbors)
4444
model.fit(x_train, y_train)
4545

4646
with open(output_file, "wb") as f:

s3_reproducibility/config_files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ or using `hydra` for loading the configuration
8080
```python
8181
import hydra
8282

83-
@hydra.main(config_name="basic.yaml")
83+
@hydra.main(config_name="config.yaml")
8484
def main(cfg):
8585
print(cfg.hyperparameters.batch_size, cfg.hyperparameters.learning_rate)
8686

s5_continuous_integration/cml.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ repository.
342342
types: staged_model
343343
```
344344

345+
Do note that the `repository_dispatch` event will only trigger a workflow run if the workflow file exists
346+
on the default branch. Therefore, if you are testing this on a branch, you need to push the workflow file
347+
to the default branch.
348+
345349
8. Next, we need to implement the steps in our workflow that do something when a model is staged. The payload that
346350
is sent to the webhook contains information about the model that was staged. Implement a workflow that:
347351

0 commit comments

Comments
 (0)