PyTorch

From scalding to auto-divideing to recoverable training code.

Readable articles
25
System Chapters
2

Linking concepts with system chapters.

Read the whole thing first

2 Articles
  1. Complete a training loop

    Align data, patterns, losses, gradients, parameter updates and statistical calibres to check training codes using a small, measurable PyTorch example.

    System Chapters2 Graphics6 self-measurement
  2. PyTorch: Where the gradient goes, what the model keeps

    Checks the calculation chart, gradient add-up, parameter registration and training status, starting with leaf lengths and shared parameters.

    System Chapters2 Graphics6 self-measurement

Start with definitions, symbols and minimum examples.

Introduction

4 articles
  1. Threshold stride: How the multidimensional index finds a dimension of storage

    Thrusts are usually stored in one dimension to accompany shape, stride and starting deviation description of multi-dimensional data.

    Topical shorts1 diagram2 self-measured
  2. Inverse of broadcast: how to retrieve the gradient from the bias used for replication

    We'll add one sample to the same sample. bias ♪ When it looks like a front ♪ bias Copy to each line.

    Topical shorts2 self-measured
  3. Leaf length: Why the middle result grad defaults not to leave

    grad, which is viewed for an intermediate result during the training, obtained None, which is easily misconstrued as a branch that has not been involved in learning.

    Topical shorts2 self-measured
  4. collate_fn: convert the sample collection into a clear batch protocol

    Dataset returns a single sample, and DataLoader also requires multiple sample formation models to be entered.

    Topical shorts2 self-measured

See the difference between reasoning, realization and methodology.

Step

18 articles
  1. view and reshape: The shape is not compatible with the layout

    In order to change the matrix to a vector, it is necessary to retain the sequence of logical elements as defined.

    Topical shorts2 self-measured
  2. Conversion and continuity: exchange semantic and arrange memory

    Sequence data are commonly used [B], T, D], and some calculations are expected [B], D, T].

    Topical shorts2 self-measured
  3. expand and repeat: Storage and writing boundaries behind the same values

    Expanding a vector to multiple lines allows the same values to be obtained mathematically, while using different memory strategies.

    Topical shorts2 self-measured
  4. Index reading and writing: different compacts between basic slices and advanced indexes

    The length index also involves selecting which elements are stored in relation to the return.

    Topical shorts2 self-measured
  5. gather: Which axis the index follows, where the gradient returns

    In batch tasks, each sample may need to select a number of values based on its own index, such as extracting certain candidate scores.

    Topical shorts1 diagram2 self-measured
  6. scatter_add: Repeated target location must be highlighted

    Multiple sources may point to the same target, for example, multiple sides of the map send messages to a node, or samples are assigned to the same statistical barrel.

    Topical shorts2 self-measured
  7. detach and clone: Guidance and memory copying are two axes

    When it is necessary to keep intermediate results for logs, teacher targets or reprocessing, there are regular encounters with detach and clone.

    Topical shorts2 self-measured
  8. In situ modification and version check: who overwrites old values needed in reverse

    Some calculations require the use of forward saved input or output.

    Topical shorts2 self-measured
  9. grad for None and Zero: Optimizer may take different actions

    A clear gradient can set grad as None or the existing gradient can be kept to zero.

    Topical shorts2 self-measured
  10. no_grad and inference_mode: The reduction of records does not equal to the change of model behaviour

    model. eval changes the forward behaviour of certain modules, such as Dropout and BatchNorm; no_grad controls whether to record the gradient of the current operation.

    Topical shorts2 self-measured
  11. buffer: Non-training status also requires model contracts

    Models may need to be estimated during the training period with a unimodal mean value, fixed mask or a constant location.

    Topical shorts2 self-measured
  12. Parameter registration: Why could the layers in list be missing

    Placing several layers into normal list, forward caller one by one is likely to succeed.

    Topical shorts2 self-measured
  13. Parameter group: How different layers of step are used

    Relocation learning may lead to lower learning rates for the base and faster updates of new tasks; It may also apply only a partial decay of weight.

    Topical shorts1 diagram2 self-measured
  14. Gradient hook: Observation and modification must be named separately

    The gradient hook can be viewed in reverse to a volume of guidance received.

    Topical shorts2 self-measured
  15. PackedSequence: How to restore identity after pressing the sequence

    When recycling the network processes the long sequence, you can skip the position by packing it.

    Topical shorts2 self-measured
  16. state_dict snapshot: Saving references does not freeze optimal weight

    When the best validation indicator is seen in the training, model. state_dict is assigned to best_state, which looks like a saved model.

    Topical shorts2 self-measured
  17. Autocast: Low Precision Range, Calculator Selection and Gradient Scale

    Autocast selects the appropriate computational accuracy by sub- and context; The parameters store, optimizer state and conclusion may also use higher accuracy.

    Topical shorts2 self-measured
  18. torch. compile: calculate which input conditions are binding for the recovery of the map

    torch. compile tries to capture and optimize the compiled volume calculation.

    Topical shorts2 self-measured

Discuss assumptions, expiry conditions and systemic trade-offs.

Deep

1
  1. Customized autograd: Correct forwards do not replace reverse contracts

    Customally defined automatic fractional functions are used to encapsulate special calculations or clear reverse rules.

    Topical shorts2 self-measured
♪ Back to basics ♪
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.