Generate code

Turning a valid, saved architecture into a downloadable training project.

Generate code Once your architecture is valid and saved, Studio turns it into a standalone training project you can read, edit, and run yourself. This page covers the gate before generating, the code window, which frameworks are available, and what the download contains. Before you generate Generate becomes available once your design is saved as a project, and is enabled only when the saved version is valid. If it is disabled, its tooltip explains why: - "Fix N validation errors before generating code" - "Save this architecture version before generating code" Clicking Generate also re-checks your design on the server before generating; if the server rejects it, the tooltip reads "Server rejected N parameter errors" instead. The Generated Code window The Generated Code window shows a Framework switcher PyTorch , TensorFlow , FLAX , and DAG JSON with one tab per generated file. DAG JSON shows only dag.json , a graph architecture that Upload a DAG on the dashboard can Import a DAG file /docs/studio/versions-and-sharing import-a-dag-file . Each file has Copy and Download actions, and the window has a light or dark theme, a font size control, and a word wrap toggle. Frameworks PyTorch code generation is always available. TensorFlow and FLAX code generation need access beyond the Free plan. TensorFlow and FLAX code generation need access beyond the Free plan. See Account /docs/getting-started/account for plans in words. The size of a generated model its parameter count is also capped by plan. Download the project Download All as ZIP downloads the files of the view you have selected in the switcher, named - .zip ; with DAG JSON selected, the ZIP holds only dag.json . What is in the download The project includes model.py the architecture , train.py the training loop , smoke check.py , data.py data loading and preprocessing , requirements.txt , dag.json the graph export , and a README.md . Some designs add more files, for example launch and configuration files for multi-GPU training. The README.md covers: - An overview: the framework, when it was generated, and the linked dataset's name, type, and format, if one is linked. - Setup instructions pip install -r requirements.txt . - Dataset setup: with a dataset linked, the code downloads it automatically once you set your personal API key as an environment variable, or through a temporary signed URL good for a limited time when the code includes one. You can also download the dataset yourself, place it in the ./data directory, and point data.py at that local copy see the commented "LOCAL DATA OVERRIDE" section in data.py . Without a linked dataset, it trains on placeholder data until you link one in Studio and regenerate. - How to train it yourself: install the requirements, sign in with dagnam login , and run train.py . A local run writes its metrics to a local file and does not report to Dagnam on its own; to see its progress on a job page in Dagnam, run it through dagnam training attach . See Train on your own hardware /docs/training/own-hardware . dagnam login , dagnam training attach and the automatic dataset download use a personal API key. Personal API keys need a paid plan; the Free plan does not include them. On Free, download the dataset yourself or use the signed URL if the code includes one, and run train.py on its own. See Account /docs/getting-started/account for plans in words, and ask through Support /support to request access during the beta.
Open in Dagnam.AI docs