| Crates.io | trustformers-models |
| lib.rs | trustformers-models |
| version | 0.1.0-alpha.1 |
| created_at | 2025-11-09 10:16:23.879986+00 |
| updated_at | 2025-11-09 10:16:23.879986+00 |
| description | Model implementations for TrustformeRS |
| homepage | |
| repository | https://github.com/cool-japan/trustformers |
| max_upload_size | |
| id | 1923939 |
| size | 3,755,073 |
Comprehensive transformer model implementations for various NLP and vision tasks.
This crate provides extensive model coverage with 15+ transformer architectures implemented, including state-of-the-art models like LLaMA, Mistral, and CLIP. All models are designed for production use with efficient inference and training support.
use trustformers_models::{
bert::{BertModel, BertConfig},
gpt2::{GPT2Model, GPT2Config},
llama::{LlamaModel, LlamaConfig},
AutoModel,
};
// Load a pre-trained BERT model
let bert = AutoModel::from_pretrained("bert-base-uncased")?;
// Create a GPT-2 model from config
let config = GPT2Config::gpt2_medium();
let gpt2 = GPT2Model::new(&config)?;
// Load LLaMA with custom config
let llama_config = LlamaConfig::llama_7b();
let llama = LlamaModel::new(&llama_config)?;
bert-base-uncased: 110M parametersbert-large-uncased: 340M parametersroberta-base: 125M parametersalbert-base-v2: 11M parameters (shared)distilbert-base-uncased: 66M parametersgpt2: 124M parametersgpt2-medium: 355M parametersgpt2-large: 774M parametersgpt2-xl: 1.5B parametersllama-7b: 7B parametersllama-13b: 13B parametersmistral-7b: 7B parametersgemma-2b: 2B parametersqwen-0.5b: 0.5B parameterstrustformers-models/
├── src/
│ ├── bert/ # BERT and variants
│ ├── gpt2/ # GPT-2 family
│ ├── t5/ # T5 models
│ ├── llama/ # LLaMA architectures
│ ├── mistral/ # Mistral models
│ ├── clip/ # Multimodal models
│ ├── auto/ # Auto model classes
│ └── utils/ # Shared utilities
| Model | Parameters | Inference (ms) | Memory (GB) |
|---|---|---|---|
| BERT-base | 110M | 5.2 | 0.4 |
| GPT-2 | 124M | 8.1 | 0.5 |
| LLaMA-7B | 7B | 42.3 | 13.5 |
| Mistral-7B | 7B | 38.7 | 13.0 |
Benchmarks on NVIDIA A100, batch size 1, sequence length 512
Planned additions include:
MIT OR Apache-2.0