Skip to main content

A universal low-resource deep learning framework - Learn More with Less

Project description

MiniLin Framework

Learn More with Less - A universal low-resource deep learning framework

English | 中文 | Русский | Français | العربية

Python Version License Version

What is MiniLin?

MiniLin is a deep learning framework designed for low-resource scenarios where data is scarce and computational resources are limited. It provides an end-to-end automated workflow for text, image, and audio tasks, with built-in optimization for edge device deployment.

Key Features

  • 3-Line Solution: Complete ML pipeline from data to deployment
  • Auto Strategy Selection: Automatically chooses optimal training strategy based on data size
  • Lightweight Models: Pre-integrated efficient models (DistilBERT, MobileNet, Wav2Vec2)
  • Model Compression: Quantization, pruning, and knowledge distillation
  • Edge Deployment: Export to ONNX, PyTorch, TFLite
  • Multi-Modal Support: Text, image, and audio tasks
  • Few-Shot Learning: LoRA, Adapter, and Prompt Tuning
  • Data Augmentation: Back-translation, Mixup, CutMix, SpecAugment
  • API Deployment: FastAPI REST API server

Installation

Basic Installation

pip install minilin

With Optional Dependencies

# For vision tasks
pip install minilin[vision]

# For audio tasks
pip install minilin[audio]

# For optimization features
pip install minilin[optimization]

# For deployment
pip install minilin[deployment]

# Install everything
pip install minilin[all]

From Source

git clone https://github.com/alltobebetter/minilin.git
cd minilin
pip install -e .

Quick Start

Basic Usage (3 lines!)

from minilin import AutoPipeline

pipeline = AutoPipeline(task="text_classification", data_path="./data")
pipeline.train()
pipeline.deploy(output_path="./model.onnx")

Advanced Usage

from minilin import AutoPipeline

pipeline = AutoPipeline(
    task="text_classification",
    data_path="./data",
    target_device="mobile",
    max_samples=500,
    compression_level="high"
)

analysis = pipeline.analyze_data()
print(f"Strategy: {analysis['recommended_strategy']}")

pipeline.train(epochs=10, batch_size=16, learning_rate=2e-5)

metrics = pipeline.evaluate()
print(f"Accuracy: {metrics['accuracy']:.4f}")

pipeline.deploy(output_path="./model.onnx", quantization="int8")

Advanced Features

Few-Shot Learning with LoRA

from minilin.models import apply_few_shot_method

model = apply_few_shot_method(model, method="lora", r=8, alpha=16)
pipeline.train(max_samples=50, epochs=20)

Knowledge Distillation

from minilin.optimization import KnowledgeDistiller

distiller = KnowledgeDistiller(
    teacher_model=large_model,
    student_model=small_model,
    temperature=3.0,
    alpha=0.5
)

metrics = distiller.distill(train_loader, val_loader, epochs=5)

Multi-Modal Learning

from minilin.models import create_multimodal_model

model = create_multimodal_model(
    text_model_name="distilbert-base-uncased",
    image_model_name="mobilenetv3_small_100",
    audio_model_name="facebook/wav2vec2-base",
    num_classes=10,
    fusion_method="attention"
)

FastAPI Deployment

from minilin.deployment import serve_model

serve_model(
    model_path="./model.onnx",
    task="text_classification",
    host="0.0.0.0",
    port=8000
)

Supported Tasks

Text Tasks

  • Text Classification
  • Named Entity Recognition (NER)
  • Sentiment Analysis

Vision Tasks

  • Image Classification
  • Image Augmentation (Mixup, CutMix)

Audio Tasks

  • Audio Classification
  • Audio Augmentation (SpecAugment)

Multi-Modal Tasks

  • Text + Image
  • Text + Audio
  • Text + Image + Audio

Core Modules

Data Layer

  • DataAnalyzer: Automatic data analysis and quality assessment
  • DataLoader: Support for JSON, JSONL, CSV, TXT, directory formats
  • DataAugmenter: Text augmentation (synonym, insertion, deletion, swap)
  • BackTranslator: Back-translation (googletrans, DeepL)
  • ImageAugmenter: Image augmentation (Mixup, CutMix, transforms)
  • AudioAugmenter: Audio augmentation (noise, shift, speed, SpecAugment)

Model Layer

  • ModelZoo: Pre-integrated lightweight models
  • Trainer: Text model trainer with auto hyperparameter tuning
  • ImageTrainer: Image model trainer
  • AudioTrainer: Audio model trainer
  • MultiModalModel: Multi-modal fusion model
  • Few-Shot Learning: LoRA, Adapter, Prompt Tuning

Optimization Layer

  • Quantizer: INT8/FP16 quantization
  • Pruner: Structured/unstructured pruning
  • KnowledgeDistiller: Teacher-Student distillation
  • ModelCompressor: Compression orchestration

Deployment Layer

  • ModelExporter: Export to ONNX, PyTorch, TFLite
  • ModelServer: FastAPI REST API server
  • Edge Optimization: Mobile and embedded device support

Performance

  • Training Speed: 2-3x faster than standard training
  • Model Size: Compressed to 10-20% of original size
  • Inference Speed: Real-time on edge devices (>30 FPS)
  • Accuracy Loss: <2% after compression

Examples

Check out the examples directory:

Configuration

Configuration File

Create ~/.minilin/config.json:

{
  "translation_api_key": "your-api-key",
  "huggingface_token": "your-token",
  "cache_dir": "~/.minilin/cache"
}

Environment Variables

export MINILIN_TRANSLATION_API_KEY="your-api-key"
export MINILIN_HUGGINGFACE_TOKEN="your-token"

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact


Made with ❤️ by the MiniLin Team

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

minilin-0.2.1.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minilin-0.2.1-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file minilin-0.2.1.tar.gz.

File metadata

  • Download URL: minilin-0.2.1.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for minilin-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c29e4feb1701692f4a177bde2d7f991c1f19e56b4a07cc457783f9638b766d35
MD5 0850856039636b85aad724a3f3e197e9
BLAKE2b-256 aace6a6e4f3a25d92648d2e7c0f1a6c55f7b4b7084c3a507ed936d9c8c4eeec3

See more details on using hashes here.

File details

Details for the file minilin-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: minilin-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for minilin-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab3984dc9a76bf2223330a8f8ec61301604dd097ed56af9f45adcc9637491e90
MD5 88a6152e30e28fc169f0210b29cd9f0d
BLAKE2b-256 77ea2b32cb28a40a661cba5438e612d0658cbf3a87ce8d8eeb9bbdcea783cdf0

See more details on using hashes here.

Supported by

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