Text Generation
Transformers
Safetensors
Japanese
English
llama
llm-jp
math
sft
full-parameter-finetuning
team-victory
experiment-0399
wandb
conversational
text-generation-inference
Instructions to use argo11/0399-tv-full-thinking-fp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use argo11/0399-tv-full-thinking-fp with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="argo11/0399-tv-full-thinking-fp") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("argo11/0399-tv-full-thinking-fp") model = AutoModelForCausalLM.from_pretrained("argo11/0399-tv-full-thinking-fp", 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 argo11/0399-tv-full-thinking-fp with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "argo11/0399-tv-full-thinking-fp" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "argo11/0399-tv-full-thinking-fp", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/argo11/0399-tv-full-thinking-fp
- SGLang
How to use argo11/0399-tv-full-thinking-fp 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 "argo11/0399-tv-full-thinking-fp" \ --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": "argo11/0399-tv-full-thinking-fp", "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 "argo11/0399-tv-full-thinking-fp" \ --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": "argo11/0399-tv-full-thinking-fp", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use argo11/0399-tv-full-thinking-fp with Docker Model Runner:
docker model run hf.co/argo11/0399-tv-full-thinking-fp
| # llm-jp-4 tokenizer | |
| from collections.abc import Sequence | |
| import os | |
| from transformers import LlamaTokenizerFast | |
| from tokenizers import Tokenizer | |
| from .llmjp4_harmony import HarmonyMessageParser, HarmonyMessage | |
| class Llmjp4Tokenizer(LlamaTokenizerFast): | |
| _HARMONY_TOKENS: set[str] = { | |
| "<|start|>", | |
| "<|message|>", | |
| "<|channel|>", | |
| "<|constrain|>", | |
| "<|end|>", | |
| "<|return|>", | |
| "<|call|>", | |
| } | |
| # NOTE(odashi): | |
| # Response schemas are not recognized automatically. | |
| # We need to define them manually. | |
| # https://github.com/huggingface/trl/issues/4609 | |
| _RESPONSE_SCHEMA = { | |
| "type": "object", | |
| "properties": { | |
| "role": {"const": "assistant"}, | |
| "content": {"type": "string", "x-regex": r"<\|channel\|>final<\|message\|>(.*?)(?:<\|end\|>|<\|return\|>|$)"}, | |
| "thinking": {"type": "string", "x-regex": r"<\|channel\|>analysis<\|message\|>(.*?)<\|end\|>"}, | |
| "tool_calls": { | |
| "x-regex-iterator": r"<\|channel\|>commentary (to=functions\..*?<\|message\|>.*?)(?:<\|call\|>|$)", | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "type": {"const": "function"}, | |
| "function": { | |
| "type": "object", | |
| "properties": { | |
| "name": {"type": "string", "x-regex": r"^to=functions\.(\w+)"}, | |
| "arguments": { | |
| "type": "object", | |
| "x-regex": r"<\|message\|>(.*)", | |
| "x-parser": "json", | |
| "additionalProperties": {"type": "any"}, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| } | |
| def convert_to_native_format(cls, **kwargs): | |
| # NOTE(odashi): | |
| # Workaround for transformers 5.x. | |
| # Guaranteeing the same inner behavior with TokenizersBackend. | |
| # https://github.com/huggingface/transformers/blob/7d9754a05193eb79b1d86aa744b622b8068008cd/src/transformers/tokenization_utils_tokenizers.py#L110-L116 | |
| local_kwargs = dict(kwargs) | |
| fast_tokenizer_file = local_kwargs.pop("tokenizer_file", None) | |
| if fast_tokenizer_file is None or not os.path.isfile(fast_tokenizer_file): | |
| raise ValueError("Tokenizer file must exist.") | |
| local_kwargs["tokenizer_object"] = Tokenizer.from_file(fast_tokenizer_file) | |
| return local_kwargs | |
| def __init__(self, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| self.response_schema = self._RESPONSE_SCHEMA | |
| self._harmony_token_ids = { | |
| self.convert_tokens_to_ids(token) | |
| for token in self._HARMONY_TOKENS | |
| } | |
| def _decode(self, token_ids: int | list[int], *args, **kwargs): | |
| if isinstance(token_ids, int): | |
| token_ids = [token_ids] | |
| result: list[str] = [] | |
| prev_pos = 0 | |
| # NOTE(odashi): | |
| # Ensure that text tokens are decoded without preceding Harmony tokens | |
| # to avoid incorrect addition of whitespaces. | |
| for pos, token_id in enumerate(token_ids, start=1): | |
| if token_id in self._harmony_token_ids or pos == len(token_ids): | |
| result.append(super()._decode(token_ids[prev_pos:pos], *args, **kwargs)) | |
| prev_pos = pos | |
| return "".join(result) | |
| def parse_harmony_message(self, token_ids: Sequence[int]) -> list[HarmonyMessage]: | |
| """Helper function to parse token IDs into Harmony messages.""" | |
| return HarmonyMessageParser(self).get_all_messages(token_ids) | |