# Volumes

> Keep files such as model weights in a named volume that every container of your workspace can mount.

Canonical page: https://klio.tech/docs/volumes

## Mount a volume

```python
from klio_compute import function, Volume

weights = Volume(name="weights", mount_path="./weights")

@function(volumes=[weights], gpu="L40S")
def load():
    with open("./weights/model.bin", "rb") as f:
        return len(f.read())
```

A volume is created the first time it is used and keeps its files between runs.

## Move files from the command line

```bash
klio volume create weights
klio volume put weights ./model.bin
klio volume ls weights
klio volume get weights model.bin ./model.bin
klio volume list
```

`klio volume cp` copies within a volume, and `klio volume delete` removes one. With the Modal-compatible API, `Volume.reload()` right after a commit in another container waits until the data is readable there, which can take a moment.
