Skip to main content

Leverage torchstack to build transfor based ensembles

Project description

🫧 TorchStack [work in progress]

Build scalable ensemble systems for transformer-based models.

torchstack is a library designed to simplify the creation and deployment of scalable ensemble learning systems for Hugging Face transformers. It provides tools to address challenges like tokenizer mismatch, voting strategies, and model integration, making ensemble learning accessible and efficient for natural language processing tasks.


🚀 Features

  • High-Level API: Simplifies ensemble learning, inspired by Keras for transformers.
  • Tokenizer Compatibility: Support for union vocabularies, projections (e.g., DEEPEN), and other solutions to handle tokenizer mismatches.
  • Flexible Voting Strategies: Includes average voting, majority voting, and extensible custom strategies.
  • Integration with Hugging Face: Seamlessly works with Hugging Face models and tokenizers.
  • Production-Ready: Tools for building, testing, and deploying your ensemble systems with ease.

📦 Tools and Libraries

Core Tooling

Core Dependencies

  • Transformers: Core library for transformer-based models.
  • Torch: Deep learning framework for model integration and training.
  • Loguru: Advanced logging with rotation, retention, and compression.

📖 Example Usage

Text Generation

poetry run python examples/text-generation/run.py

Text Classification

poetry run python examples/text-classification/run.py

Running the Service

  • Development Mode:
    uv run
    
  • Production Mode:
    uv build
    

🛠️ Guides


🔧 Build Process

The uv tool builds a source distribution first, followed by a binary distribution (wheel). You can customize the build process:

  • Build only a source distribution:
    uv build --sdist
    
  • Build only a binary distribution:
    uv build --wheel
    
  • Build both distributions from source:
    uv build --sdist --wheel
    

⚙️ Build Isolation

By default, uv builds all packages in isolated virtual environments, following PEP 517. However, some packages (e.g., PyTorch) may require disabling build isolation. To do so, add the dependency to the no-build-isolation-package list in your pyproject.toml file.


📝 Roadmap

  • Implement remote model integration (ensemble.add_remote_member).
  • Add more voting strategies and tokenization solutions.
  • Publish and manage ensembles on Hugging Face Model Repository.
  • Expand documentation with tutorials and advanced examples.

💬 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request. See the Contributing Guide for more details.


📄 License

This project is licensed under the MIT License.


This revised README focuses on being engaging, informative, and structured, with clear headings, concise descriptions, and actionable examples. Let me know if you’d like further refinements or to add anything specific!

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

torchstack-0.1.0.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

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

torchstack-0.1.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file torchstack-0.1.0.tar.gz.

File metadata

  • Download URL: torchstack-0.1.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.19

File hashes

Hashes for torchstack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a08b0a2ef50b245818bfab940d22035b0c0430258f0a008ef7b6d7d08975871
MD5 d62b461153d91ecb4b3f6df9d3374382
BLAKE2b-256 e71c8dd57a3eec95b0beed2a1864069256dcaaeaf8a8beac6ca8600b0abd7831

See more details on using hashes here.

File details

Details for the file torchstack-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: torchstack-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.19

File hashes

Hashes for torchstack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09ef334446afbb7c97490f6b5b5c1dd98a4294385e9c3343c6485a1661b1c61a
MD5 6159c7d048a3f8e18c8cbf22f703779c
BLAKE2b-256 fd164e95e86527baec2e613ed8a0927fe7a7a49ad5b068939dd729db299aa5b4

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