Skip to content

Allow calling fit multiple times with Quantization (QAT) #7427

@t-vi

Description

@t-vi

🐛 Bug

When using the QuantizationAwareTraining() callback, one cannot call Trainer.fit twice.

To Reproduce

Call Trainer.fit twice on any model gives an exception (which is pretty qpaque, I might add)

Expected behavior

Resumes training

Additional context

I imagine here is a tradeoff between two goals:

  1. Have fit return a model that's ready for inference,
  2. don't catapult yourself irreversibly out of the option to continue training.

With Quantization Aware Training's conversion step at the end (moving from fake quantization for QAT to quantized layers), we have to choose one. Currently, the QAT hook converts, so it has 1 but not 2.

To my mind, the conversion step is "preparing for export / inference" rather than part of training, so I would suggest to drop it from the fitting part.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions