# ValueError: The model is quantized with QuantizationMethod.QUANTO and is not serializable

**URL:** <https://discuss.huggingface.co/t/valueerror-the-model-is-quantized-with-quantizationmethod-quanto-and-is-not-serializable/84159>\
**Category:** 🤗Transformers\
**Created:** [April 28, 2024, 10:38am UTC](https://discuss.huggingface.co/t/valueerror-the-model-is-quantized-with-quantizationmethod-quanto-and-is-not-serializable/84159 "2024-04-28T10:38:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gospacedev](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/gospacedev/32/26312_2.png) [@gospacedev](https://discuss.huggingface.co/u/gospacedev)\
**Post date:** [April 28, 2024, 10:38am UTC](https://discuss.huggingface.co/t/valueerror-the-model-is-quantized-with-quantizationmethod-quanto-and-is-not-serializable/84159/1 "2024-04-28T10:38:41Z")

</div>

Hi, I have quantized the model flan-t5-base to bit8, and I am trying to upload it to huggingface but I keep getting this error:

```auto
ValueError: The model is quantized with QuantizationMethod.QUANTO and is not serializable - check out the warnings from the logger on the traceback to understand the reason why the quantized model is not serializable.

```

Here’s the code:

```python
from transformers import T5Tokenizer, T5ForConditionalGeneration, QuantoConfig

quantization_config = QuantoConfig(weights="int8")
quantized_model = T5ForConditionalGeneration.from_pretrained(model_id, low_cpu_mem_usage=True, quantization_config=quantization_config)

quantized_model.push_to_hub("flan-t5-base-8bit")

```

---

<div class="post-metadata">

**Author:** ![tiago-machado](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@tiago-machado](https://discuss.huggingface.co/u/tiago-machado)\
**Post date:** [May 20, 2024, 8:23pm UTC](https://discuss.huggingface.co/t/valueerror-the-model-is-quantized-with-quantizationmethod-quanto-and-is-not-serializable/84159/2 "2024-05-20T20:23:49Z")

</div>

Same problem when trying to save the quantized model using `save_pretrained`
