Text Generation
Transformers
Safetensors
taonet
trust-remote-code
sentencepiece
custom-architecture
custom_code
Instructions to use TaoTern/TaoNet-mini-A2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TaoTern/TaoNet-mini-A2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TaoTern/TaoNet-mini-A2", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TaoTern/TaoNet-mini-A2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TaoTern/TaoNet-mini-A2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TaoTern/TaoNet-mini-A2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TaoTern/TaoNet-mini-A2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TaoTern/TaoNet-mini-A2
- SGLang
How to use TaoTern/TaoNet-mini-A2 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 "TaoTern/TaoNet-mini-A2" \ --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": "TaoTern/TaoNet-mini-A2", "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 "TaoTern/TaoNet-mini-A2" \ --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": "TaoTern/TaoNet-mini-A2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TaoTern/TaoNet-mini-A2 with Docker Model Runner:
docker model run hf.co/TaoTern/TaoNet-mini-A2
| """In-repo CNN vision encoder for multimodal training.""" | |
| from typing import Sequence | |
| import torch | |
| import torch.nn as nn | |
| class CNNEncoder(nn.Module): | |
| """A compact convolutional encoder for single-image multimodal inputs.""" | |
| def __init__( | |
| self, | |
| image_size: int, | |
| output_dim: int, | |
| channels: Sequence[int] = (32, 64, 128), | |
| kernel_size: int = 3, | |
| ): | |
| """Initialize the CNN encoder.""" | |
| super().__init__() | |
| if image_size < 8: | |
| raise ValueError("image_size must be at least 8") | |
| if output_dim < 1: | |
| raise ValueError("output_dim must be positive") | |
| if not channels: | |
| raise ValueError("channels must contain at least one stage") | |
| layers: list[nn.Module] = [] | |
| in_channels = 3 | |
| stride = 2 | |
| padding = kernel_size // 2 | |
| for channel_dim in channels: | |
| layers.extend([ | |
| nn.Conv2d(in_channels, channel_dim, kernel_size=kernel_size, stride=stride, padding=padding), | |
| nn.BatchNorm2d(channel_dim), | |
| nn.GELU(), | |
| ]) | |
| in_channels = channel_dim | |
| self.backbone = nn.Sequential(*layers) | |
| self.pool = nn.AdaptiveAvgPool2d((1, 1)) | |
| self.projection = nn.Linear(in_channels, output_dim) | |
| def forward(self, pixel_values: torch.Tensor) -> torch.Tensor: | |
| """Encode pixel values into a single feature vector per image.""" | |
| features = self.backbone(pixel_values) | |
| pooled = self.pool(features).flatten(1) | |
| return self.projection(pooled) | |