pytorch_project_template

BlinorotMIT更新放缓

一套开箱即用的 PyTorch 深度学习项目模板,集成配置管理与实验追踪,支持多 GPU、多节点的大规模分布式训练。

PyTorch template for Deep Learning projects with support for scalable multi-GPU and multi-node training.

暂无版本257star38fork同步于 2026-11-07 07:31 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -r requirements.txt
pre-commit install
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求;多机多卡训练能力见 HF Main 分支说明。

多卡 / 张量并行
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

PyTorch 深度学习项目模板,帮你快速搭起可复现、可扩展的训练工程骨架

一套开箱即用的 PyTorch 深度学习项目模板,集成配置管理与实验追踪,支持多 GPU、多节点的大规模分布式训练。

核心能力

  • 用 Hydra 管理配置,提升实验可复现性
  • 集成 WandB 与 Comet ML 做实验跟踪
  • 用 pre-commit 自动格式化代码并做检查
  • 提供 train.py 与 inference.py 统一训练推理入口
  • HF Main 分支支持多机多卡与混合精度

容易踩的坑

main 分支部分代码为空或仅占位示例,需自行补全任务代码;多机多卡、混合精度等能力在 HF Main 分支而非 main 分支;训练需用 -cn 指定 src/configs 下的配置名。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    PyTorch Template for DL projects

    About

    This repository contains a template for PyTorch-based Deep Learning projects.

    The template utilizes different python-dev techniques to improve code readability. Configuration methods enhance reproducibility and experiments control.

    The repository is released as a part of the HSE DLA course, however, can easily be adopted for any DL-task.

    This template is the official recommended template for the EPFL CS-433 ML Course.

    New: we added a HF Main variant of the template with HuggingFace Integration for multi-GPU and multi-node training, automatic mixed precision, gradient accumulation, and seamless HuggingFace Ecosystem Compatibility.

    📖 If you use this template in your work, please cite this repository or include a reference. Attribution supports the project and encourages continued development.

    Tutorials

    This template utilizes experiment tracking techniques, such as WandB and Comet ML, and Hydra for the configuration. It also automatically reformats code and conducts several checks via pre-commit. If you are not familiar with these tools, we advise you to look at the tutorials below:

    To start working with a template, just click on the use this template button.

    You can choose any of the branches as a starting point. Set your choice as the default branch in the repository settings. You can also delete unnecessary branches.

    Examples

    [!IMPORTANT] The main branch leaves some of the code parts empty or fills them with dummy examples, showing just the base structure. The final users can add code required for their own tasks.

    You can find examples of this template completed for different tasks in other branches:

    • HF Main: the variant of the main branch with HuggingFace Integration. Supports multi-GPU and multi-node training, automatic mixed precision, gradient accumulation, and seamless HuggingFace Ecosystem Compatibility.

    • Image classification: simple classification problem on MNIST and CIFAR-10 datasets.

    • ASR: template for the automatic speech recognition (ASR) task. Some of the parts (for example, collate_fn and beam search for text_encoder) are missing for studying purposes of HSE DLA course.

    Installation

    Installation may depend on your task. The general steps are the following:

    1. (Optional) Create and activate new environment using conda or venv (+pyenv).

      a. conda version:

      # create env
      conda create -n project_env python=PYTHON_VERSION
      
      # activate env
      conda activate project_env
      

      b. venv (+pyenv) version:

      # create env
      ~/.pyenv/versions/PYTHON_VERSION/bin/python3 -m venv project_env
      
      # alternatively, using default python version
      python3 -m venv project_env
      
      # activate env
      source project_env/bin/activate
      
    2. Install all required packages

      pip install -r requirements.txt
      
    3. Install pre-commit:

      pre-commit install
      

    How To Use

    To train a model, run the following command:

    python3 train.py -cn=CONFIG_NAME HYDRA_CONFIG_ARGUMENTS
    

    Where CONFIG_NAME is a config from src/configs and HYDRA_CONFIG_ARGUMENTS are optional arguments.

    To run inference (evaluate the model or save predictions):

    python3 inference.py HYDRA_CONFIG_ARGUMENTS
    

    Useful Links:

    You may find the following links useful:

    Credits

    This repository is based on a heavily modified fork of pytorch-template and asr_project_template repositories.

    License

    License