neuralmagic / sparsezoo

Neural network model repository for highly sparse and sparse-quantized models with matching sparsification recipes
Apache License 2.0
364 stars 24 forks source link

is there any support for yolov4-mish model ? #153

Closed akashAD98 closed 2 years ago

akashAD98 commented 2 years ago

I'm using this repo for object detection https://github.com/AlexeyAB/darknet ,there are very good models which has a good map on coco, so is there any way to support this model?

also i have a few questions about neuralmagic

  1. lets say if i trained model using any framework (im using alexyab darknet-yolov4-mish model), can i use model weights & apply your techniques to get sparsemodel?
  2. if i converted my model into onnx ,can i able to use your libraries furture? to get high fps on cpu?
  3. also lots of confusion in documents .not able to understand from where should we start? bcz there are similar names such as SparseML, Sparsify, DeepSparse .
KSGulin commented 2 years ago

Hey @akashAD98, great questions.

To answer Q3 first: SparseML is an optimization library which provides tools to prune and quantize models. You can immediately run our supported integrations (e.g. HuggingFace Transformers, Ultralytics Yolov5) or with a bit of setup run with a custom integration. Deepsparse on the other hand is the engine built to exploit high sparsity in models to accelerate them to high performance on CPUs.

You can use SparseML with most pytorch models by wrapping it with ScheduledModifierManager. You can find our instructions for how to set that up here.

This allows you to run the model with a recipe which can prune, quantize, or otherwise alter the training schedule. You can read more on how to construct recipes here and I'd also recommend checking out the How to Optimize Deep Learning Models for Production workshop that we just held today and will have uploaded on our Youtube channel soon.

Our most effective pruning methods are training-aware, which means they are employed during training. These methods gradually prune during training and allow your model to converge with the new pruned structure. You can technically apply a pruning recipe in a "one-shot" manner and we have a short example of it here, but you won't be able to achieve the same accuracy/sparsity tradeoff. We are currently researching more effective one-shot methods though and plan to expand that capability in the future.

Once you have a sparse model, you'll want to export it to onnx and run it through DeepSparse. You can run your original onnx model through DeepSparse as well for comparison.

Hope that helps!

akashAD98 commented 2 years ago

@KSGulin thanks for your information, it's an open-source project ?

KSGulin commented 2 years ago

@akashAD98 yes, all the libraries mentioned are open-source. The engine is the one component which we have not open sourced.