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
| """Verify that TaoTrain checkpoint weights match the exported HF package exactly.""" | |
| from pathlib import Path | |
| import torch | |
| from export_to_hf import normalize_checkpoint, sanitize_model_state | |
| from modeling_taonet import TaoNetForCausalLM | |
| def summarize_tensor_diff(left: torch.Tensor, right: torch.Tensor) -> str: | |
| if left.shape != right.shape: | |
| return f"shape mismatch: {tuple(left.shape)} != {tuple(right.shape)}" | |
| if left.dtype != right.dtype: | |
| right = right.to(dtype=left.dtype) | |
| if left.dtype.is_floating_point: | |
| diff = (left - right).abs() | |
| return f"max_abs_diff={diff.max().item():.8g}, mean_abs_diff={diff.mean().item():.8g}" | |
| unequal = (left != right).sum().item() | |
| return f"unequal_values={unequal}" | |
| def main(): | |
| repo_dir = Path(__file__).resolve().parent | |
| checkpoint_path = repo_dir / "checkpoints" / "sft" / "final_model.pt" | |
| checkpoint = torch.load(checkpoint_path, map_location="cpu") | |
| checkpoint_state, _ = normalize_checkpoint(checkpoint) | |
| checkpoint_state, ignored_keys = sanitize_model_state(checkpoint_state) | |
| model = TaoNetForCausalLM.from_pretrained(str(repo_dir)) | |
| exported_state = model.model.state_dict() | |
| checkpoint_keys = set(checkpoint_state) | |
| exported_keys = set(exported_state) | |
| missing = sorted(exported_keys - checkpoint_keys) | |
| unexpected = sorted(checkpoint_keys - exported_keys) | |
| print(f"checkpoint tensors: {len(checkpoint_keys)}") | |
| print(f"exported tensors: {len(exported_keys)}") | |
| if ignored_keys: | |
| print(f"ignored checkpoint buffers: {len(ignored_keys)}") | |
| if missing: | |
| print("\nKeys present in exported model but missing from checkpoint:") | |
| for key in missing[:50]: | |
| print(f" - {key}") | |
| if unexpected: | |
| print("\nKeys present in checkpoint but missing from exported model:") | |
| for key in unexpected[:50]: | |
| print(f" - {key}") | |
| common_keys = sorted(checkpoint_keys & exported_keys) | |
| mismatches = [] | |
| exact_matches = 0 | |
| for key in common_keys: | |
| left = checkpoint_state[key].cpu() | |
| right = exported_state[key].cpu() | |
| if left.shape == right.shape and torch.equal(left, right.to(dtype=left.dtype) if right.dtype != left.dtype else right): | |
| exact_matches += 1 | |
| continue | |
| mismatches.append((key, summarize_tensor_diff(left, right))) | |
| print(f"\nexact tensor matches: {exact_matches}/{len(common_keys)}") | |
| print(f"tensor mismatches: {len(mismatches)}") | |
| if mismatches: | |
| print("\nFirst mismatches:") | |
| for key, summary in mismatches[:50]: | |
| print(f" - {key}: {summary}") | |
| raise SystemExit(1) | |
| if missing or unexpected: | |
| raise SystemExit(1) | |
| print("\nWeight verification passed.") | |
| if __name__ == "__main__": | |
| main() | |