2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

変換前に量子化することで高速化できます。

AnimeGANを量子化

import torch
model = torch.hub.load("bryandlee/animegan2-pytorch:main", "generator", pretrained="celeba_distill").eval()
model_int8 = torch.quantization.convert(model)

dummy_input = torch.randn(1, 3, 512, 512)
input_names = [ "input" ]
output_names = [ "var_444" ]

torch.onnx.export(model_int8z, dummy_input, "animegan2_celeba_distill.onnx", verbose=True, input_names=input_names, output_names=output_names, opset_version=11)

ColabのGPUランタイムで試すと、これで推論が倍高速になりました。

🐣


フリーランスエンジニアです。
お仕事のご相談こちらまで
rockyshikoku@gmail.com

Core MLやARKitを使ったアプリを作っています。
機械学習/AR関連の情報を発信しています。

Twitter
Medium
GitHub

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?