explaingit

tingsongyu/pytorch-tutorial-2nd

4,506Jupyter NotebookAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

Companion code for a Chinese-language PyTorch book taking readers from zero to production, covering computer vision, NLP, large language model deployment, and ONNX/TensorRT export.

Mindmap

mindmap
  root((pytorch-tutorial-2nd))
    What It Does
      PyTorch fundamentals
      Applied ML projects
      Production deployment
    Tech Stack
      Python and PyTorch
      ONNX and TensorRT
    Topics Covered
      Computer vision
      NLP and Transformers
      LLM deployment
    Use Cases
      Learn ML from scratch
      Deploy trained models
      Run Chinese LLMs
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Follow along with the book to learn computer vision tasks like image classification, object detection, and image generation using PyTorch.

USE CASE 2

Deploy a trained PyTorch model to production using ONNX or TensorRT for faster inference on real hardware.

USE CASE 3

Run Chinese open-source LLMs like Qwen or ChatGLM locally using the provided deployment guides and code.

USE CASE 4

Build an NLP pipeline for text classification, translation, or question answering using Transformer architectures.

Tech stack

PythonPyTorchJupyter NotebookONNXTensorRTTransformers

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a GPU and a working CUDA-enabled PyTorch installation, most notebooks assume NVIDIA hardware.

Free for personal and educational use, but you cannot use this material in commercial products.

In plain English

This repository is the companion code for a Chinese-language book called "PyTorch Practical Tutorial, Second Edition." The book teaches how to use PyTorch, an open-source library for building and training machine learning models, starting from zero knowledge and advancing to real-world deployment. The README and content are written in Chinese, though the underlying code uses standard Python. The book is organized into three sections. The first covers PyTorch fundamentals: setting up a development environment, working with data, building models, and visualizing results. The second section covers applied projects across three main areas. In computer vision, topics include image classification, object detection, image segmentation, object tracking, image generation using both older GAN methods and newer diffusion-based methods, image description, and image search. In natural language processing, the book covers standard architectures like RNNs, Transformers, and BERT, applied to tasks like text classification, translation, and question answering. It also covers large language model deployment, walking through four Chinese open-source models: Qwen, ChatGLM, Baichuan, and Yi. The third section focuses on getting trained models into production, covering two frameworks called ONNX and TensorRT that convert PyTorch models into faster formats for deployment, plus model quantization techniques that reduce size and speed up inference. All the code is available free and open online, readable either through the GitHub repository or a companion documentation website. The license is CC BY-NC 4.0, which means you can use and share the material for personal or educational purposes but not for commercial products. The author spent roughly five years on both editions combined and notes that more chapters will be added over time as the AI field evolves.

Copy-paste prompts

Prompt 1
Using the pytorch-tutorial-2nd code, show me how to train an image classifier on a custom dataset with PyTorch DataLoader and a ResNet backbone.
Prompt 2
Walk me through converting a trained PyTorch model to ONNX format and then running inference with TensorRT for faster production deployment.
Prompt 3
How do I load and run inference on the Qwen or ChatGLM model using the deployment code from pytorch-tutorial-2nd?
Prompt 4
Show me how to implement a Transformer-based text classification model following the NLP chapters in pytorch-tutorial-2nd.
Prompt 5
Using the diffusion model examples from pytorch-tutorial-2nd, walk me through generating an image from a text prompt step by step.
Open on GitHub → Explain another repo

← tingsongyu on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.