Giter Club home page Giter Club logo

Comments (10)

markurtz avatar markurtz commented on May 22, 2024 1

Hi @antimo22, this recipe was created originally for the COCO dataset. Other datasets can require more or fewer epochs and this is a hyperparameter that you should feel free to edit. We're also going to be updating some new flows to make the editing of these hyperparams in recipes easier.

If you have a chance, could you try and run one of the transfer recipes such as this one: https://github.com/neuralmagic/sparseml/blob/main/integrations/ultralytics-yolov5/recipes/yolov5.transfer_learn_pruned_quantized.md This will run in a shorter amount of time. If you'd like to run for fewer epochs then we'd recommend editing the recipe and changing the num_epochs and the quantization_start_epoch to smaller values that meet your requirements.

from sparseml.

bfineran avatar bfineran commented on May 22, 2024

Hi @antimo22 could you share the recipe you applied as well as the number of epochs the model was trained for?

from sparseml.

antimo22 avatar antimo22 commented on May 22, 2024

Hi @bfineran, thank you for your reply. I applied this recipe: yolov5s.pruned_quantized.md (https://github.com/neuralmagic/sparseml/blob/main/integrations/ultralytics-yolov5/tutorials/sparsifying_yolov5_using_recipes.md)

I tried to use the weights of the epoch1, but also of next epochs (I've noticed that the weights size are different, they go from 86MB to 114MB).

BTW, I had another problem, related to this error: "cannot import name 'container_abcs' from 'torch._six'"
That I solved importing container_abcs from collections.abc
But I think this is related to some python version incompatibility.

from sparseml.

bfineran avatar bfineran commented on May 22, 2024

Hi @antimo22 it looks like you are trying to export a model with a quantization recipe with non quantized weights (ie weights obtained from epoch 1). This will cause issues because the export script will expect the checkpoint to have quantized weights.

When you notice the weight file size increase, this is likely when quantization begins as extra parameters are injected to track the quantization (such as "model.0.conv.conv.quant.activation_post_process.scale"). Have you tried exporting from one of these checkpoints?

from sparseml.

antimo22 avatar antimo22 commented on May 22, 2024

Yes, I tried to export the model from the epoch 6, that is around 114 MB. Should I have to continue the training for more epochs?

from sparseml.

bfineran avatar bfineran commented on May 22, 2024

stopping early depends on the amount of recovery you are looking to get. Additionally, to get a quantized checkpoint, you must stop after quantization has been applied in the recipe. Could you point me to the exact recipe you are using? If quantization is applied before epoch 6, then you should be fine to export, recovery aside.

from sparseml.

antimo22 avatar antimo22 commented on May 22, 2024

This is the recipe I've applied: https://github.com/neuralmagic/sparseml/blob/main/integrations/ultralytics-yolov5/recipes/yolov5s.pruned_quantized.md

I see something like pruning_end_epoch 100, so I have to train for 100 epochs to end the pruning process?
BTW, I used also the epoch 10 with weights around 140MB, still the same error.

from sparseml.

jeanniefinks avatar jeanniefinks commented on May 22, 2024

Hi @antimo22
Checking in here to see if you were able to try out one of our recommended recipes? We're happy to help.
Thanks!
Jeannie / Neural Magic

from sparseml.

jeanniefinks avatar jeanniefinks commented on May 22, 2024

Hello @antimo22
As there have been no further comments on this, we will close out this issue. Feel free to re-open it however if you would like to continue the conversation. Thank you!
Jeannie / Neural Magic

from sparseml.

dnth avatar dnth commented on May 22, 2024

To anyone facing the same issue - I had the same problem as @antimo22 and confirm that the solution by @markurtz works!

from sparseml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.