MultiModel-AI
A Python module for efficient multi-model AI inference with memory management.
Features
- Efficient memory management for multiple AI models
- Automatic model loading and unloading
- Support for various AI model types
- Easy-to-use API
Installation
pip install multimodel-ai
Usage
from multimodel_ai import ModelManager
# Initialize the model manager
manager = ModelManager()
# Load a model
model = manager.load_model("model_name")
# Use the model
result = model.predict(input_data)
# The model will be automatically unloaded when not in use
Examples
Basic Usage
from multimodel_ai import ModelManager
# Initialize the manager
manager = ModelManager()
# Load a model
model = manager.load_model("gpt2")
# Generate text
text = model.generate("Hello, world!")
# The model will be automatically unloaded
Multiple Models
from multimodel_ai import ModelManager
# Initialize the manager
manager = ModelManager()
# Load multiple models
model1 = manager.load_model("gpt2")
model2 = manager.load_model("bert")
# Use the models
text1 = model1.generate("Hello")
text2 = model2.classify("World")
# Models will be automatically unloaded when not in use
Custom Model Configuration
from multimodel_ai import ModelManager
# Initialize the manager with custom settings
manager = ModelManager(
max_memory_usage=0.8, # Use up to 80% of available memory
model_cache_dir="./models" # Custom cache directory
)
# Load a model with specific configuration
model = manager.load_model(
"gpt2",
device="cuda",
precision="fp16"
)
# Use the model
result = model.generate("Hello, world!")
Error Handling
from multimodel_ai import ModelManager, ModelError
try:
manager = ModelManager()
model = manager.load_model("non_existent_model")
except ModelError as e:
print(f"Error loading model: {e}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for multimodel-ai 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| multimodel_ai-0.1.6.tar.gz | 5.7 kB | Without provenance | Details for multimodel_ai-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multimodel_ai-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for multimodel_ai-0.1.6-py3-none-any.whl |
Total release size: 11.7 kB
Release files / multimodel_ai-0.1.6.tar.gz
| Download URL | multimodel_ai-0.1.6.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63d6cda8b624b08272f79de984fd0c752e34af5dcd7f1abb45bb910c8f0a0ade
|
|
BLAKE2b-256 checksum How to use checksums |
267636bb1e5283983e52fbe7fad3fe60e0926969e07cfeb95a375212c920730e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / multimodel_ai-0.1.6-py3-none-any.whl
| Download URL | multimodel_ai-0.1.6-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1681fe0acaf25bb58ac37750975bb361f3f2bcb3895f9f324f8bd698c0640090
|
|
BLAKE2b-256 checksum How to use checksums |
6a1ee82a00a76a338c3dc7243ab3bcef04224ef37d7a8d231ab817316a1d2ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Security for multimodel-ai 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.