始める無料で始める

Apply dynamic quantization

You've successfully trained a neural network model for deployment, and now you want to optimize it using dynamic quantization. This step is crucial for deploying your model efficiently in environments with limited resources.

The model has been pre-loaded.

この演習はコースの一部です

Scalable AI Models with PyTorch Lightning

コースを見る

演習の手順

  • Import the necessary quantization module from PyTorch.
  • Apply dynamic quantization targeting linear layers, using 8-bit integer precision.

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

import torch
# Import the necessary quantization module
from torch.quantization import ____

# Apply dynamic quantization targeting linear layers
model_quantized = torch.quantization.____(
    ____, {torch.nn.____}, dtype=torch.____
)
コードを編集して実行