|
29 | 29 |
|
30 | 30 |
|
31 | 31 | def init( |
32 | | - project: str, name: str | None = None, space_id=None, config: dict | None = None |
| 32 | + project: str, |
| 33 | + name: str | None = None, |
| 34 | + space_id: str | None = None, |
| 35 | + config: dict | None = None, |
33 | 36 | ) -> Run: |
| 37 | + """ |
| 38 | + Creates a new Trackio project and returns a Run object. |
| 39 | +
|
| 40 | + Args: |
| 41 | + project: The name of the project (can be an existing project to continue tracking or a new project to start tracking from scratch). |
| 42 | + name: The name of the run (if not provided, a default name will be generated). |
| 43 | + space_id: If provided, the project will be logged to a Hugging Face Space instead of a local directory. Should be a complete Space name like "username/reponame". If the Space does not exist, it will be created. If the Space already exists, the project will be logged to it. |
| 44 | + config: A dictionary of configuration options. Provided for compatibility with wandb.init() |
| 45 | + """ |
34 | 46 | if not current_server.get(): |
35 | 47 | if space_id is None: |
36 | 48 | _, url, _ = demo.launch( |
@@ -89,18 +101,33 @@ def init( |
89 | 101 |
|
90 | 102 |
|
91 | 103 | def log(metrics: dict) -> None: |
| 104 | + """ |
| 105 | + Logs metrics to the current run. |
| 106 | +
|
| 107 | + Args: |
| 108 | + metrics: A dictionary of metrics to log. |
| 109 | + """ |
92 | 110 | if current_run.get() is None: |
93 | 111 | raise RuntimeError("Call trackio.init() before log().") |
94 | 112 | current_run.get().log(metrics) |
95 | 113 |
|
96 | 114 |
|
97 | 115 | def finish(): |
| 116 | + """ |
| 117 | + Finishes the current run. |
| 118 | + """ |
98 | 119 | if current_run.get() is None: |
99 | 120 | raise RuntimeError("Call trackio.init() before finish().") |
100 | 121 | current_run.get().finish() |
101 | 122 |
|
102 | 123 |
|
103 | 124 | def show(project: str | None = None): |
| 125 | + """ |
| 126 | + Launches the Trackio dashboard. |
| 127 | +
|
| 128 | + Args: |
| 129 | + project: The name of the project whose runs to show. If not provided, all projects will be shown and the user can select one. |
| 130 | + """ |
104 | 131 | _, url, share_url = demo.launch( |
105 | 132 | show_api=False, |
106 | 133 | quiet=True, |
|
0 commit comments