You can read and write to your Volume like any ordinary Python file:
Copy
Ask AI
from beta9 import function, VolumeVOLUME_PATH = "./model_weights"@function( volumes=[Volume(name="model-weights", mount_path=VOLUME_PATH)],)def access_files(): # Write files to a volume with open(f"{VOLUME_PATH}/somefile.txt", "w") as f: f.write("Writing to the volume!") # Read files from a volume with open(f"{VOLUME_PATH}/somefile.txt", "r") as f: f.read()