Text Generation
Transformers
PyTorch
Safetensors
English
i3
i3-architecture
hybrid-model
rwkv-mamba
custom_code
Instructions to use i3-lab/i3-80m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use i3-lab/i3-80m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="i3-lab/i3-80m", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("i3-lab/i3-80m", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use i3-lab/i3-80m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "i3-lab/i3-80m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "i3-lab/i3-80m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/i3-lab/i3-80m
- SGLang
How to use i3-lab/i3-80m with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "i3-lab/i3-80m" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "i3-lab/i3-80m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "i3-lab/i3-80m" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "i3-lab/i3-80m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use i3-lab/i3-80m with Docker Model Runner:
docker model run hf.co/i3-lab/i3-80m
| # example_run.py | |
| from i3_model import i3Model, ChunkTokenizer | |
| from modeling_i3 import I3ForCausalLM, I3Config | |
| from tokenizer_i3 import I3Tokenizer | |
| import torch | |
| # Path to local model files (current folder) | |
| model_path = "." | |
| # Load tokenizer | |
| tokenizer = I3Tokenizer(vocab_file=f"{model_path}/chunk_vocab_combined.json") | |
| # Load HF-style model | |
| model = I3ForCausalLM.from_pretrained(model_path) | |
| model.eval() | |
| # Example prompt | |
| prompt = "hello, how are you" | |
| # Encode text | |
| input_ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long) | |
| # Optional: move to GPU if available | |
| device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| model.to(device) | |
| input_ids = input_ids.to(device) | |
| # Generate tokens | |
| with torch.no_grad(): | |
| generated_ids = model.i3.generate( | |
| input_ids, | |
| max_new_tokens=50, | |
| temperature=0.8, | |
| top_k=40 | |
| ) | |
| # Decode generated text | |
| generated_text = tokenizer.decode(generated_ids[0].cpu().tolist()) | |
| print("Generated text:", generated_text) | |