Skip to main content

Automatically distill large foundational models into smaller, in-domain models for deployment

Project description

👋 hello

Automatically distill large, foundational models into smaller, realtime models via unsupervised and semi-supervised methods. Go from images to inference on a custom model with no labeling in between. Autodistill transfers knowledge from general models to domain-specific models that can run on the edge.

autodistill contains code to:

  • load base models (like CLIP)
  • load target models (like YOLO)
  • automatically create labeled datasets from raw image data
  • (optional) add a human in the loop for dataset review & curation
  • train target models
  • (optional) deploy trained models

💻 install

Pip install the supervision package in a 3.10>=Python>=3.7 environment.

pip install autodistill
Install from source
</code></pre>
</details>
<h2>🚀 examples</h2>
<pre lang="python"><code>from autodistill.base_models.instance_segmentation import GroundedSAM
from autodistill.base_models import classDescriptionOntology
from autodistill.target_models.instance_segmentation import YOLOv8,

# load ontology from json file
ontology from = classDescriptionOntology("path/to/ontology.json")

# load base model
base_model = GroundedSAM(ontology=ontology)
base_model.view_prediction(img_path="path/to/example.jpg") 

# create context
context_path = base_model.label(context="path/to/images/directory", upload_dataset_to_roboflow=False)

# destill target model
target_model = YOLOv8(size="n", hyper_params)
distilled_model = target_model.train(labeled_context=context_path, deploy_model_to_roboflow=False)
distilled_model.view_pred(img_path="path/to/example.jpg")
  • base_models are models that have been pre-trained to have a wide breadth of knowledge.

  • Base models have ontologies which are the prompts we can use to draw predictions from them. Deciding the proper ontology (and installing your CUDA drivers) is most of the work you will have to do to train distilled models with autodistill.

  • To distill a model, you will need to bring example data of the context you want to your model to operate in.

  • target_models are the smaller in-domain model to distill the larger base model into. These are a set of models that are known to perform well under supervised settings.

📍 roadmap

🚧 - work in progress

object detection

base / target YOLOv5 YOLOv7 YOLOv8 RT-DETR
Grounded DINO
Grounded SAM 🚧
DETIC
OWL-ViT

instance segmentation

base / target YOLOv5 YOLOv7 YOLOv8 RT-DETR
Grounded SAM 🚧

classification

base / target YOLOv8 YOLOv5
CLIP

🏆 contribution

We love your input! Please see our contributing guide to get started. Thank you 🙏 to all our contributors!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autodistill-0.0.6.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

autodistill-0.0.6-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page