Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Quantization aware training resume with checkpoint #185

Closed
aab60526 opened this issue Mar 11, 2019 · 3 comments
Closed

Quantization aware training resume with checkpoint #185

aab60526 opened this issue Mar 11, 2019 · 3 comments
Labels
bug Something isn't working quantization The issue is related to quantization

Comments

@aab60526
Copy link

Hello, when I training a resuming model with checkpoint,
It raise an error
image
And this is my command line
image
Where is the error come from?

@guyjacob
Copy link
Contributor

It's not 100% clear from the command line, but I assume you're trying to resume training from a previous quantization-aware training session. Unfortunately, that's not supported at the moment (see comment here).
(In case you want to load a quantization-aware training checkpoint just for evaluation, you can use the workaround detailed here)

We're currently working on fixing some other issues related to loading checkpoints (see #182), once that's finalized I'll try to get quantization-aware training resume soon after.

@guyjacob guyjacob added this to Needs triage in distiller dev via automation Apr 2, 2019
@parap1uie-s
Copy link

Maybe, you could try is:

  1. Follow the steps here to hack the distiller framework.

  2. Create two model

resume_model = create_model(<your params>)
new_model = create_model(<your params same as resume model>)
  1. Resume quantized weights to resume model
    if args.resume:
        resume_model, _, _ = apputils.load_checkpoint(resume_model, chkpt_file=args.resume)
        resume_model.to(args.device)
  1. Quantize the new model
    if args.compress:
        compression_scheduler = distiller.file_config(new_model, optimizer, args.compress, compression_scheduler)

Now, you have a resume model which contains quantized trained weights, and a new model contains random initial quantized weights.

  1. Load weights
new_model.load_state_dict(copy.deepcopy(resume_model.state_dict()))
del(resume_model)

@guyjacob guyjacob moved this from Needs triage to Quantization in distiller dev Apr 3, 2019
@guyjacob guyjacob added bug Something isn't working quantization The issue is related to quantization labels May 2, 2019
@levzlotnik levzlotnik moved this from Quantization to In Progress in distiller dev Aug 6, 2019
@nzmora nzmora closed this as completed Apr 16, 2020
distiller dev automation moved this from In Progress to Closed Apr 16, 2020
@thnguyen996
Copy link

Hi, does anyone figure out any quick way to fix this bug? I really need to run evaluation on quantized model

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working quantization The issue is related to quantization
Projects
distiller dev
  
Closed
Development

No branches or pull requests

5 participants