Comments (10)
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.
Hi @antimo22 could you share the recipe you applied as well as the number of epochs the model was trained for?
from sparseml.
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.
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.
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.
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.
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.
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.
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.
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)
- My own model HOT 1
- PyTorch 2.1.0 and Lightning 2.1.0 Support: AssertionError on `assert self._strategy is not None` HOT 13
- Question on quantization size HOT 2
- Add ScheduledModifierManager.from_str HOT 1
- Adding a `.pre-commit-config.yaml` file for maintaining consistent style and code quality. HOT 3
- Oriented Bounding Box support HOT 1
- Sparse ML not working for Transformers HOT 3
- Models with loops in their graph can't be converted to DeepSparse after QAT HOT 4
- RecursionError when converting LlaMa model to ONNX HOT 6
- Error converting mistral to onnx HOT 13
- SparseML/YOLOv5s - ValueError: Unable to find any modifiers in given recipe. HOT 1
- Feature Request: Oriented Bounding Box Sparsification for YOLOv5/YOLOv8 on Custom Models/Datasets HOT 1
- [Roadmap] SparseML Roadmap Q1 2024 HOT 1
- Regarding the execution speed and model size after Sparsifying ResNet-50 HOT 2
- Class Index change observed when validating a yolov5 pruned sparseml model HOT 2
- yolov5 sparse fine tuning error HOT 2
- [Roadmap] SparseML Roadmap Q2 2024
- Does Sparseml support Integer-Arithmetic-Only Inference? HOT 1
- recipe.yaml not found HOT 3
- Missing key(s) in state_dict: "model.0.conv.quant.activation_post_process.scale" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparseml.