-
Notifications
You must be signed in to change notification settings - Fork 172
docs: add usage documentation for TrainerClient options #405
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,3 +60,37 @@ Options Reference | |
| .. autoclass:: kubeflow.trainer.options.ContainerPatch | ||
| :members: | ||
| :show-inheritance: | ||
|
|
||
| Using options with TrainerClient | ||
| =============================== | ||
|
|
||
| The ``options`` parameter in ``TrainerClient`` allows users to customize runtime behavior | ||
| and backend-specific configurations for training jobs. | ||
|
|
||
| It provides flexibility to control how training jobs are executed depending on the | ||
| selected backend (e.g., Kubernetes, local, container). | ||
|
|
||
| Example | ||
| ------- | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from kubeflow.trainer import TrainerClient, CustomTrainer | ||
|
|
||
| def train_fn(): | ||
| print("Training...") | ||
|
|
||
| client = TrainerClient() | ||
|
|
||
| job_id = client.train( | ||
| trainer=CustomTrainer(func=train_fn), | ||
| options={ | ||
| "epochs": 10, | ||
| "batch_size": 32 | ||
| } | ||
| ) | ||
|
|
||
| client.wait_for_job_status(job_id) | ||
|
|
||
| The ``options`` dictionary can include different parameters depending on the backend | ||
| and runtime configuration. | ||
|
Comment on lines
+95
to
+96
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example shows
optionsas a dictionary with{"epochs": 10, "batch_size": 32}, but theoptionsparameter should be a list of option objects (e.g.,[Name("custom-name"), Labels({...})]). According to the TrainerClient API signature and the options module design, options must be objects fromkubeflow.trainer.optionsthat can be called to modify the job specification. The current example misleads users about the correct API usage.