# PyTorch-Tutorial-2nd: a free Chinese book from tensor basics to TensorRT deployment

> PyTorch-Tutorial-2nd is TingsongYu's free online book, the second edition of the practical PyTorch tutorial, organized in three parts from PyTorch fundamentals through industry applications in computer vision, NLP and LLMs to deployment with ONNX and TensorRT, including PTQ and QAT quantization. The companion code is open, the book is CC BY-NC 4.0 licensed, and the second edition took years to complete.

**TingsongYu/PyTorch-Tutorial-2nd** — 《Pytorch实用教程》（第二版）无论是零基础入门，还是CV、NLP、LLM项目应用，或是进阶工程化部署落地，在这里都有。相信在本书的帮助下，读者将能够轻松掌握 PyTorch 的使用，成为一名优秀的深度学习工程师。

- Repository: https://github.com/TingsongYu/PyTorch-Tutorial-2nd
- Website: https://tingsongyu.github.io/PyTorch-Tutorial-2nd/
- Stars: 4,615 · Forks: 494
- Language: Jupyter Notebook
- License: not declared
- Published: 2026-09-09 · Updated: 2026-09-09 · Language: en
- Canonical page: https://hysenlabs.com/projects/tingsongyu-pytorch-tutorial-2nd

## Five years, four years, two years

The book's introduction opens with its own timeline, five years since the first edition, four years in the making, two years of concentrated work, the second edition of the practical PyTorch tutorial is complete. The delay narrative is stated with humor rather than apology, and the appendix preserves it in a table of stopped-updates, a headache project in early 2022, more projects and newcomers by mid-2022, and the birth of the author's child in 2023, each with dates and durations, struck through because they are past. The additions over the first edition are named, rich and detailed deep learning application cases and an inference deployment framework, making the book systematically cover the knowledge surface of a deep learning engineer. The online edition is free and open, and the release tag names the milestone, v1.0.0, the PDF and epub publication in May 2024.

## Three parts: foundation, application, deployment

The book is organized in three parts with explicit metaphors, the foundation as bedrock, computer vision, natural language processing and large language models as the core, and the deployment framework as the bridge, aiming to provide project-oriented code engineering and theory. The first part targets beginners, non-CS-background readers and undergraduates, covering the PyTorch introduction, development environment setup, and the core modules of data, models, optimization and visualization, ending by building a personal code structure for later use. The second part applies the toolkit across three domains, and the third turns trained models into services, the sequencing that gives the book its engineering rather than academic character.

## Eight CV tasks and five NLP tasks

The computer vision chapter enumerates eight mainstream tasks, image classification, image segmentation, object detection, object tracking, GAN generation, Diffusion generation, image captioning and image retrieval, the catalog spanning the discriminative and generative sides of the field. The NLP chapter details RNN, LSTM, Transformer, BERT and GPT models with their applications, covering five tasks, text classification, machine translation, named entity recognition, question answering and article generation. The enumeration matters for a reader choosing a tutorial, since the chapters double as a checklist of what the book does not cover, and the LLM chapter continues the pattern with four deployment and code-analysis studies plus one industry application, GPT Academic, the academic optimization tool.

## The four Chinese open-source LLMs

The LLM section focuses on China's four mainstream open-source models, Qwen, ChatGLM, Baichuan and Yi, covering their deployment and code analysis rather than treating LLMs as a single API call. This selection is itself a positioning statement, the book aims at Chinese-speaking engineers who will deploy these specific models in domestic environments, and the pairing of deployment with code analysis means the reader sees inside the models rather than only calling them. Combined with the GPT Academic industry application, the chapter serves the reader who must go from downloaded weights to a working service, the gap that generic LLM tutorials skip.

## ONNX, TensorRT, PTQ and QAT

The deployment part addresses the step most tutorials omit, taking a model from PyTorch, a training framework, out of the framework through deployment, acceleration and quantization, described as the common method. The chapters introduce the principles and usage of ONNX and TensorRT, and with TensorRT analyze model quantization in detail, covering post-training quantization, PTQ, and quantization-aware training, QAT, in both practice and principle. The stated goal of the whole arc is closing the loop, helping beginners avoid detours, master PyTorch quickly, choose algorithm models for real scenarios, and deploy models into usable, good-to-use algorithm services, the full pipeline from tensor to served inference that defines the working deep learning engineer the introduction addresses.

## A community behind a password

The reader community runs through QQ groups, and the entry mechanism is unusual, to ensure discussion quality, joining requires a password, and the password is obtained by reading a specific source file in the author's code repository, a display of show_confmat code, the kind of puzzle that filters for readers who actually run the examples. Five groups are listed, four marked full and the fifth open, and recent group sharing covers CV project practice, LLM inference deployment and RAG systems. The book has been collected by the HelloGitHub community with a badge, and the star history chart is generated automatically every seven days by a GitHub Action with a script, the repo's own infrastructure celebrating its own popularity.

## CC BY-NC, and the book's living status

The licensing differs from typical tutorial repositories, the work is licensed under Creative Commons Attribution-NonCommercial 4.0, the NC clause separating this free book from commercial reuse, and GitHub reports the repository's license as unknown because the book license applies rather than a code license. The repository structure is minimal, asset, code and scripts directories beside the readme and workflows. The repository was pushed 2026-09-29, the day before this writing, so the second edition remains under active maintenance, and the author's closing message frames it as a new departure rather than an end, setting sail again for new technologies and new chapters, with the book online and free throughout.

## Conclusion

Read PyTorch-Tutorial-2nd if you learn Chinese and want one resource carrying you from PyTorch basics through project applications to deployment engineering, since the three-part structure and the quantization chapters are rarely covered in beginner material. Skip it if you need English, the book is written in Chinese with no English edition indicated. Before starting, read the book online for free rather than hunting for PDFs, clone the companion code repository to follow the examples, and note the license, CC BY-NC 4.0, which permits non-commercial use only, a distinction from the code repositories most tutorials carry.

## FAQ

### What is the best PyTorch tutorial?

For Chinese-speaking learners, PyTorch-Tutorial-2nd is a strong candidate, a free online book spanning PyTorch fundamentals, eight computer vision tasks, five NLP tasks, four Chinese open-source LLMs, and deployment with ONNX and TensorRT including PTQ and QAT quantization, with companion code open on GitHub.

### What is PyTorch used for?

In this book's framing, PyTorch is the training framework behind deep learning applications across computer vision, natural language processing and large language models, and its models are later deployed through ONNX and TensorRT. The tutorial covers the data, model, optimization and visualization modules that make up PyTorch's core.

### Is PyTorch still relevant in 2026?

Yes, and this second edition is evidence, completed after years of work with chapters on the current generation of topics, Diffusion generation, GPT-style models, the Qwen, ChatGLM, Baichuan and Yi open-source LLMs, and modern deployment with ONNX and TensorRT, with the repository still maintained in 2026.

## Sources

- [Issues](https://github.com/TingsongYu/PyTorch-Tutorial-2nd/issues)
- [Project website](https://tingsongyu.github.io/PyTorch-Tutorial-2nd/)
- [README](https://github.com/TingsongYu/PyTorch-Tutorial-2nd/blob/main/README.md)
- [Releases](https://github.com/TingsongYu/PyTorch-Tutorial-2nd/releases)
- [TingsongYu/PyTorch-Tutorial-2nd on GitHub](https://github.com/TingsongYu/PyTorch-Tutorial-2nd)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/tingsongyu-pytorch-tutorial-2nd
