Text Generation
Transformers
TensorBoard
Safetensors
kroha_routed_norm
kroha
looped
custom_code
training-checkpoint
multi-token-prediction
conversational
Eval Results (legacy)
Instructions to use d0rj/Kroha-base-dev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use d0rj/Kroha-base-dev with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="d0rj/Kroha-base-dev", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("d0rj/Kroha-base-dev", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use d0rj/Kroha-base-dev with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "d0rj/Kroha-base-dev" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "d0rj/Kroha-base-dev", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/d0rj/Kroha-base-dev
- SGLang
How to use d0rj/Kroha-base-dev 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 "d0rj/Kroha-base-dev" \ --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": "d0rj/Kroha-base-dev", "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 "d0rj/Kroha-base-dev" \ --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": "d0rj/Kroha-base-dev", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use d0rj/Kroha-base-dev with Docker Model Runner:
docker model run hf.co/d0rj/Kroha-base-dev
Download chat_template.jinja from d0rj/Kroha-base-dev: direct link, hf CLI and curl.
- Browser
- Download file 4.52 kB
-
https://huggingface.co/d0rj/Kroha-base-dev/resolve/main/chat_template.jinja
- Command line
-
hf download hf://d0rj/Kroha-base-dev/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/d0rj/Kroha-base-dev/resolve/main/chat_template.jinja
4.52 kB
| {%- if not messages %}{{ raise_exception('A conversation must contain at least one message') }}{% endif -%} | |
| {%- if tools -%} | |
| {{- '<|im_start|>system\nAvailable tools are described by the following JSON schemas. To call a tool, emit <tool_call>{"id":"call_0","name":"tool_name","arguments":{}}</tool_call>. Use a unique id for every call. Wait for matching tool results before continuing. Call tools only when needed.\n' -}} | |
| {{- tools | tojson(sort_keys=true) -}} | |
| {{- '<|im_end|>\n' -}} | |
| {%- endif -%} | |
| {%- set state = namespace(pending={}, seen=[]) -%} | |
| {%- for message in messages -%} | |
| {%- set mi = loop.index0 -%} | |
| {%- set role = message['role'] -%} | |
| {%- if role not in ['system', 'developer', 'user', 'assistant', 'tool'] -%} | |
| {{- raise_exception('Unknown message role') -}} | |
| {%- endif -%} | |
| {%- if state.pending and role != 'tool' -%} | |
| {{- raise_exception('Unresolved tool calls before next conversation turn') -}} | |
| {%- endif -%} | |
| {%- set content = message.get('content') if message.get('content') is not none else '' -%} | |
| {%- if content is not string -%}{{ raise_exception('Text content required') }}{%- endif -%} | |
| {%- if role != 'assistant' and (message.get('reasoning_content') or message.get('tool_calls')) -%} | |
| {{- raise_exception('Only assistant can contain reasoning/tool_calls') -}} | |
| {%- endif -%} | |
| {%- set header = role -%} | |
| {%- if role == 'tool' -%} | |
| {%- set call_id = message.get('tool_call_id') -%} | |
| {%- if call_id not in state.pending -%}{{ raise_exception('Orphan or duplicate tool result') }}{%- endif -%} | |
| {%- set name = state.pending[call_id] -%} | |
| {%- if message.get('name', name) != name -%}{{ raise_exception('Tool result name mismatch') }}{%- endif -%} | |
| {%- set state.pending = dict(state.pending.items() | rejectattr('0', 'equalto', call_id)) -%} | |
| {%- set header = 'tool name=' + name + ' tool_call_id=' + call_id -%} | |
| {%- endif -%} | |
| {{- '<|im_start|>' + header + '\n' -}} | |
| {%- if role == 'assistant' -%} | |
| {% generation %} | |
| {%- if message.get('reasoning_content') -%} | |
| {{- '<think>' + message['reasoning_content'] + '</think>' -}} | |
| {%- endif -%} | |
| {{- content -}} | |
| {%- for call in message.get('tool_calls') or [] -%} | |
| {%- set name = call['function']['name'] -%} | |
| {%- set arguments = call['function'].get('arguments', {}) -%} | |
| {%- set call_id = call.get('id', 'call_' + mi|string + '_' + loop.index0|string) -%} | |
| {%- if arguments is not mapping -%}{{ raise_exception('Normalize arguments to an object before templating') }}{%- endif -%} | |
| {%- if name is not string or call_id is not string or not name or not call_id -%} | |
| {{- raise_exception('Function name and call id must be nonempty strings') -}} | |
| {%- endif -%} | |
| {%- if name|length > 128 or call_id|length > 64 or name[0] not in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_' -%} | |
| {{- raise_exception('Invalid function name or call id') -}} | |
| {%- endif -%} | |
| {%- for char in name -%} | |
| {%- if char not in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.:-' -%} | |
| {{- raise_exception('Invalid function name') -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- for char in call_id -%} | |
| {%- if char not in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-' -%} | |
| {{- raise_exception('Invalid tool call id') -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if call_id in state.seen -%}{{ raise_exception('Duplicate tool call id') }}{%- endif -%} | |
| {%- set state.seen = state.seen + [call_id] -%} | |
| {%- set state.pending = dict(state.pending, **{call_id: name}) -%} | |
| {{- '<tool_call>' -}} | |
| {{- {'id': call_id, 'name': name, 'arguments': arguments} | tojson(sort_keys=true) -}} | |
| {{- '</tool_call>' -}} | |
| {%- endfor -%} | |
| {{- '<|im_end|>' -}} | |
| {% endgeneration %} | |
| {%- else -%} | |
| {{- content + '<|im_end|>' -}} | |
| {%- endif -%} | |
| {{- '\n' -}} | |
| {%- endfor -%} | |
| {%- if add_generation_prompt -%} | |
| {%- if state.pending -%}{{ raise_exception('Cannot generate before tool results arrive') }}{%- endif -%} | |
| {{- '<|im_start|>assistant\n' -}} | |
| {%- if enable_thinking | default(false) -%}{{ '<think>' }}{%- endif -%} | |
| {%- endif -%} | |