Skip to content

0.13.1

Compare
Choose a tag to compare
@peterschmidt85 peterschmidt85 released this 17 Jan 12:51
· 757 commits to master since this release

Mounting repos via Python API

If you submit a task or a service via the Python API, you can now specify the repo with the Client.runs.submit method.

This argument accepts an instance of dstack.api.LocalRepo (which allows you to mount additional files to the run from a local folder), dstack.api.RemoteRepo (which allows you to mount additional files to the run from a remote Git repo), or dstack.api.VirtualRepo (which allows you to mount additional files to the run programmatically).

Here's an example:

repo=RemoteRepo.from_url(
    repo_url="https://github.com/dstackai/dstack-examples",
    repo_branch="main"
)
client.repos.init(repo)

run = client.runs.submit(
    configuration=...,
    repo=repo,
)

This allows you to access the additional files in your run from the mounted repo.

More examples are now available in the API documentation.

Note that the Python API is just one possible way to manage runs. Another one is the CLI. When using the CLI, it automatically mounts the repo in the current folder.

Bug-fixes

Among other improvements, the update addresses the issue that previously prevented the ability to pass custom arguments to the run using ${{ run.args }} in the YAML configuration.

Here's an example:

type: task

python: "3.11" # (Optional) If not specified, your local version is used

commands:
  - pip install -r requirements.txt
  - python train.py ${{ run.args }}
 ``

Now, you can pass custom arguments to the run via `dstack run`:

```shell
dstack run . -f train.dstack.yml --gpu A100 --train_batch_size=1 --num_train_epochs=100

In this case --train_batch_size=1 --num_train_epochs=100 will be passed to python train.py.

Contribution guide

Last but not least, we've extended our contribution guide with a new wiki page that guides you through the steps of adding a custom backend. This can be helpful if you decide to extend dstack with support for a custom backend (cloud provider).

Feel free to check out this new wiki page and share your feedback. As always, if you need help with adding custom backend support, you can always ask for assistance from our team.