> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-sandboxes-integrations-placement.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# コードを保存するにはどうすればよいですか‌

各 run とともにコードを保存すると、Experiments を再現しやすくなり、どのバージョンのコードが特定の結果を生成したのかをトラッキングできます。run を開始するメイン スクリプトまたはノートブックを保存するには、`wandb.init` で `save_code=True` を使用します。run のすべてのコードを保存するには、W\&B Artifacts でコードをバージョン管理します。次の例は、このプロセスを示しています。

```python theme={null}
code_artifact = wandb.Artifact(type="code")
code_artifact.add_file("./train.py")
wandb.log_artifact(code_artifact)
```

***

<Badge stroke shape="pill" color="orange" size="md">[Artifacts](/ja/support/models/tags/artifacts)</Badge>
