Text Generation
Transformers
Safetensors
qwen3
adherence
policy-compliance
guardrails
retail-assistant
trust_remote_code
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use AttentioResearch/tally-8b-flagship with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AttentioResearch/tally-8b-flagship with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AttentioResearch/tally-8b-flagship") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AttentioResearch/tally-8b-flagship") model = AutoModelForCausalLM.from_pretrained("AttentioResearch/tally-8b-flagship", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AttentioResearch/tally-8b-flagship with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AttentioResearch/tally-8b-flagship" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AttentioResearch/tally-8b-flagship", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AttentioResearch/tally-8b-flagship
- SGLang
How to use AttentioResearch/tally-8b-flagship 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 "AttentioResearch/tally-8b-flagship" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AttentioResearch/tally-8b-flagship", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "AttentioResearch/tally-8b-flagship" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AttentioResearch/tally-8b-flagship", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AttentioResearch/tally-8b-flagship with Docker Model Runner:
docker model run hf.co/AttentioResearch/tally-8b-flagship
File size: 2,539 Bytes
6e60a2f 01f47c4 6e60a2f afb56ed 6e60a2f afb56ed 6e60a2f 01f47c4 6e60a2f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | """HuggingFace Inference Endpoints custom handler for the Tally adherence package.
The checkpoint is NOT a standard model — the real entry point is `AdherenceModel` (a wrapper in
modeling_adherence.py: baked weights + deterministic guard + scope gate + attack cutoff), and it is NOT a
PreTrainedModel and has no `auto_map`. So the default TGI / transformers handler cannot serve the guarded
stack — it would load a plain Qwen3ForCausalLM (weights only, no guards) or fail. This handler loads the
real class and calls `.chat()`, so the endpoint serves the FULL product.
To use it, the Inference Endpoint must be created with task = "Custom" (so it picks up handler.py); a
Text-Generation / TGI task ignores this file. GPU required; device_map="auto" so the 8B shards across
multiple small GPUs (e.g. 4x T4 = 64GB) instead of OOMing on a single 16GB card.
"""
from __future__ import annotations
import importlib.util
import os
import sys
from typing import Any, Dict, List
class EndpointHandler:
def __init__(self, path: str = "") -> None:
spec = importlib.util.spec_from_file_location("modeling_adherence",
os.path.join(path, "modeling_adherence.py"))
ma = importlib.util.module_from_spec(spec)
# register BEFORE exec — modeling_adherence uses `from __future__ import annotations`, so @dataclass
# resolves its field types via sys.modules[cls.__module__]; unregistered => NoneType.__dict__ crash.
sys.modules["modeling_adherence"] = ma
spec.loader.exec_module(ma)
self.model = ma.AdherenceModel.from_pretrained(path, torch_dtype="auto", device_map="auto")
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, str]]:
inputs = data.get("inputs", data)
if isinstance(inputs, str): # plain prompt
messages = [{"role": "user", "content": inputs}]
elif isinstance(inputs, list): # OpenAI-style chat messages
messages = [{"role": m.get("role", "user"), "content": m.get("content", "")}
if isinstance(m, dict) else {"role": "user", "content": str(m)} for m in inputs]
else:
messages = [{"role": "user", "content": str(inputs)}]
params = data.get("parameters") or {}
out = self.model.chat(messages, max_new_tokens=int(params.get("max_new_tokens", 256)),
temperature=params.get("temperature"))
return [{"generated_text": out}]
|