快捷方式

安装说明

先决条件:torchtune 需要 PyTorch,因此请使用 本地启动 页面为您的主机和环境安装 PyTorch。

通过 PyPI 安装

torchtune 的最新稳定版本托管在 PyPI 上,可以使用以下命令下载

pip install torchtune

要确认软件包已正确安装,可以运行以下命令

tune

您应该看到以下输出

usage: tune [-h] {download,ls,cp,run,validate} ...

Welcome to the torchtune CLI!

options:
-h, --help            show this help message and exit

...

通过 git clone 安装

如果您想要 torchtune 的最新功能,或者想要成为贡献者,您也可以使用以下命令在本地安装软件包。

git clone https://github.com/pytorch/torchtune.git
cd torchtune
pip install -e .

安装夜间构建版本

torchtune 每天晚上都会使用 main 分支的最新提交进行构建。如果您想要软件包的最新更新,无需 通过 git clone 安装,可以使用以下命令安装

pip install --pre torchtune --extra-index-url https://download.pytorch.org/whl/nightly/cpu --no-cache-dir

注意

--no-cache-dir 将指示 pip 不要查找 torchtune 的缓存版本,从而覆盖您现有的 torchtune 安装。

如果您已安装 PyTorch,torchtune 将默认使用该版本。但是,如果您想使用 PyTorch 的夜间构建版本,可以将 --force-reinstall 选项附加到上述命令。如果您选择这种安装方法,您可能需要更改索引 URL 中的“cpu”后缀以匹配您的 CUDA 版本。例如,如果您正在运行 CUDA 12,您的索引 URL 将是“https://download.pytorch.org/whl/nightly/cu121”。

文档

访问 PyTorch 的全面的开发者文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并获得问题的解答

查看资源