aimet icon indicating copy to clipboard operation
aimet copied to clipboard

RNN can not be quantized by aimet

Open TingfengTang opened this issue 1 year ago • 1 comments

Hi,when i use aimet to quantize my rnn model,some tracing error happens.

import torch
import torch.nn as nn
from aimet_torch.model_preparer import prepare_model
rnn=nn.RNN(10,20,1)
rnn=prepare_model(rnn)
torch.fx.proxy.TraceError:symbolically traced variables cannot be used as inputs to control flow

it seems that nn.RNN can not be traced by torch.fx so i use torch.fx.symbolic_trace to directly trace the torch.nn.Rnn(10,20,1),but also failed the wheel i installed is aimet_torch-torch_cpu_pt19_1.31.0-cp38-cp38-linux_x86_64.whl

TingfengTang avatar Jul 17 '24 03:07 TingfengTang

@TingfengTang This is the issue caused by torch. To solve this remove the control flow(if, else) and hardcode the process without control flow.

RangineniBalaji avatar Sep 02 '24 09:09 RangineniBalaji

Hi @TingfengTang as @RangineniBalaji mentioned, this is indeed torch fx issue.

Coudl you please try with the latest torch if this still persists.

quic-bhushans avatar Apr 30 '25 20:04 quic-bhushans