Quantization Aware Training won't work #10967
Unanswered
Hikaru-13915
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment 1 reply
-
Dear @Hikaru-13915, Mind sharing your PyTorch version. It seems PyTorch doesn't support some operation to be quantized. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Now, I'm trying to quantize a model using callbacks, Quantization Aware Training.
But it won't work for testing.
Please somebody help me.
The cord bellow.
autoencoder = LitAutoEncoder(args)
custumised_callback=QuantizationAwareTraining(
observer_type="histogram",
modules_to_fuse=[(f"model.conv{i}",f"model.relu{i}") for i in range(1,3,1)])
trainer = pl.Trainer(gpus=1, callbacks=custumised_callback)
trainer.fit(autoencoder)
torch.save(autoencoder.state_dict(), "qat_lightning.pt")
test_loader=iter(DataLoader(MNIST(os.getcwd(), download=True, train=False, transform=transforms.ToTensor()), batch_size=args.batch_size)).next()
autoencoder(autoencoder.quant(test_loader[0]))
Though I had obtained a quantized model successfully, got an error at
autoencoder(autoencoder.quant(test_loader[0]))
The error tells me
and
trainer.test()
won't work as wellI just followed the example only to find it won't work at all
How do I quantize and test by a quantized model correctly?
Beta Was this translation helpful? Give feedback.
All reactions