Text Generation
Transformers
PyTorch
English
taonet_mini_t2
taonet
taotern
ssm
state-space-model
dplr
custom_code
experimental
Instructions to use TaoTern/TaoNet-mini-T2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TaoTern/TaoNet-mini-T2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TaoTern/TaoNet-mini-T2", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TaoTern/TaoNet-mini-T2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TaoTern/TaoNet-mini-T2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TaoTern/TaoNet-mini-T2" # 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-T2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TaoTern/TaoNet-mini-T2
- SGLang
How to use TaoTern/TaoNet-mini-T2 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-T2" \ --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-T2", "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-T2" \ --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-T2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TaoTern/TaoNet-mini-T2 with Docker Model Runner:
docker model run hf.co/TaoTern/TaoNet-mini-T2
| """Factory for creating datasets based on configuration.""" | |
| from taoTrain.config import TrainingConfig, TrainingModeEnum | |
| from taoTrain.data.pretrain_jsonl import PretrainJSONLDataset | |
| from taoTrain.data.sft_jsonl import SFTJSONLDataset | |
| from taoTrain.data.rl_jsonl import RLJSONLDataset | |
| try: | |
| from taoTrain.data.hf_pretrain import PretrainDataset | |
| from taoTrain.data.hf_sft import SFTDataset | |
| from taoTrain.data.hf_rl import RLDataset | |
| except ImportError: | |
| PretrainDataset = None | |
| SFTDataset = None | |
| RLDataset = None | |
| class DatasetFactory: | |
| """Factory for creating datasets based on configuration.""" | |
| # Registry of dataset classes by mode and backend | |
| DATASETS = { | |
| (TrainingModeEnum.PRETRAIN, "jsonl"): PretrainJSONLDataset, | |
| (TrainingModeEnum.SFT, "jsonl"): SFTJSONLDataset, | |
| (TrainingModeEnum.RL, "jsonl"): RLJSONLDataset, | |
| } | |
| if PretrainDataset is not None: | |
| DATASETS.update({ | |
| (TrainingModeEnum.PRETRAIN, "huggingface"): PretrainDataset, | |
| (TrainingModeEnum.SFT, "huggingface"): SFTDataset, | |
| (TrainingModeEnum.RL, "huggingface"): RLDataset, | |
| }) | |
| def create_dataset( | |
| config: TrainingConfig, | |
| split: str = "train", | |
| ): | |
| """ | |
| Create dataset instance based on configuration. | |
| Args: | |
| config: Training configuration | |
| split: Dataset split (train, validation, test) - primarily for HuggingFace datasets | |
| Returns: | |
| Dataset instance matching the configured mode and backend | |
| Raises: | |
| ValueError: If configuration is invalid or unsupported mode/backend combination | |
| """ | |
| # Determine backend: JSONL or HuggingFace | |
| if config.dataset.local: | |
| backend = "jsonl" | |
| else: | |
| backend = "huggingface" | |
| # Get mode | |
| mode = config.mode | |
| # Look up dataset class | |
| key = (mode, backend) | |
| if key not in DatasetFactory.DATASETS: | |
| if backend == "huggingface": | |
| raise ImportError( | |
| "HuggingFace dataset support requires the optional 'datasets' dependency. " | |
| "Install project dependencies before using dataset.local=false." | |
| ) | |
| raise ValueError( | |
| f"Unsupported dataset configuration: mode={mode.value}, backend={backend}. " | |
| f"Supported: {list(DatasetFactory.DATASETS.keys())}" | |
| ) | |
| dataset_class = DatasetFactory.DATASETS[key] | |
| # Instantiate dataset | |
| if backend == "jsonl": | |
| # JSONL datasets don't use split parameter | |
| return dataset_class(config) | |
| else: | |
| # HuggingFace datasets use split parameter | |
| return dataset_class(config, split=split) | |
| def register_dataset(mode: TrainingModeEnum, backend: str, dataset_class): | |
| """ | |
| Register a custom dataset class. | |
| Args: | |
| mode: Training mode (e.g., TrainingModeEnum.PRETRAIN) | |
| backend: Backend name (e.g., "jsonl", "huggingface") | |
| dataset_class: Dataset class to register | |
| """ | |
| DatasetFactory.DATASETS[(mode, backend)] = dataset_class | |
| def list_available_datasets(): | |
| """List all available dataset configurations.""" | |
| configs = {} | |
| for (mode, backend), dataset_class in DatasetFactory.DATASETS.items(): | |
| key = f"{mode.value}_{backend}" | |
| configs[key] = { | |
| "mode": mode.value, | |
| "backend": backend, | |
| "class": dataset_class.__name__, | |
| } | |
| return configs | |