Text Generation
Transformers
Safetensors
glm4
eklav
math-reasoning
cot-distillation
reasoning
cotgen
conversational
Instructions to use AdarshSingh7647/Eklav-9B-Math-CotGen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AdarshSingh7647/Eklav-9B-Math-CotGen with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AdarshSingh7647/Eklav-9B-Math-CotGen") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AdarshSingh7647/Eklav-9B-Math-CotGen") model = AutoModelForCausalLM.from_pretrained("AdarshSingh7647/Eklav-9B-Math-CotGen", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AdarshSingh7647/Eklav-9B-Math-CotGen with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AdarshSingh7647/Eklav-9B-Math-CotGen" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AdarshSingh7647/Eklav-9B-Math-CotGen", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AdarshSingh7647/Eklav-9B-Math-CotGen
- SGLang
How to use AdarshSingh7647/Eklav-9B-Math-CotGen 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 "AdarshSingh7647/Eklav-9B-Math-CotGen" \ --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": "AdarshSingh7647/Eklav-9B-Math-CotGen", "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 "AdarshSingh7647/Eklav-9B-Math-CotGen" \ --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": "AdarshSingh7647/Eklav-9B-Math-CotGen", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AdarshSingh7647/Eklav-9B-Math-CotGen with Docker Model Runner:
docker model run hf.co/AdarshSingh7647/Eklav-9B-Math-CotGen
Upload merged HETU model (base + LoRA merged, final checkpoint)
Browse files- .gitattributes +1 -0
- README.md +20 -0
- chat_template.jinja +45 -0
- config.json +36 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +22 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: zai-org/GLM-Z1-9B-0414
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- hetu
|
| 6 |
+
- mathreasoning
|
| 7 |
+
- cotgen
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# HETU-GLM-Z1-9B-MathReasoning-CotGen
|
| 11 |
+
|
| 12 |
+
Part of the **HETU (Hints Enable True Understanding)** model suite.
|
| 13 |
+
|
| 14 |
+
- **Base model:** [zai-org/GLM-Z1-9B-0414](https://huggingface.co/zai-org/GLM-Z1-9B-0414)
|
| 15 |
+
- **Task:** math reasoning (AIME, GSM8K, MATH-500, Omni-MATH, GPQA-Diamond, MMLU)
|
| 16 |
+
- **Method:** trained to generate a full chain-of-thought before producing its output (CotGen)
|
| 17 |
+
|
| 18 |
+
This is the full merged model (base weights + LoRA adapter merged in), final training checkpoint, in bf16.
|
| 19 |
+
|
| 20 |
+
See the HETU paper for the training setup, evaluation methodology, and results tables.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[gMASK]<sop>
|
| 2 |
+
{%- if tools -%}
|
| 3 |
+
<|system|>
|
| 4 |
+
你是一个名为 ChatGLM 的人工智能助手。你是基于智谱 AI 公司训练的语言模型 GLM-4 模型开发的,你的任务是针对用户的问题和要求提供适当的答复和支持。
|
| 5 |
+
|
| 6 |
+
# 可用工具
|
| 7 |
+
{%- for tool in tools %}
|
| 8 |
+
{%- set function = tool.function if tool.get("function") else tool %}
|
| 9 |
+
|
| 10 |
+
## {{ function.name }}
|
| 11 |
+
|
| 12 |
+
{{ function | tojson(indent=4, ensure_ascii=False) }}
|
| 13 |
+
在调用上述函数时,请使用 Json 格式表示调用的参数。
|
| 14 |
+
{%- endfor %}
|
| 15 |
+
{%- endif -%}
|
| 16 |
+
|
| 17 |
+
{%- for msg in messages %}
|
| 18 |
+
{%- if msg.role == 'system' %}
|
| 19 |
+
<|system|>
|
| 20 |
+
{{ msg.content }}
|
| 21 |
+
{%- endif %}
|
| 22 |
+
{%- endfor %}
|
| 23 |
+
|
| 24 |
+
{%- for message in messages if message.role != 'system' %}
|
| 25 |
+
{%- set role = message['role'] %}
|
| 26 |
+
{%- set content = message['content'] %}
|
| 27 |
+
{%- set visible = content.split('</think>')[-1].strip() %}
|
| 28 |
+
{%- set meta = message.get("metadata", "") %}
|
| 29 |
+
|
| 30 |
+
{%- if role == 'user' %}
|
| 31 |
+
<|user|>
|
| 32 |
+
{{ visible }}
|
| 33 |
+
{%- elif role == 'assistant' and not meta %}
|
| 34 |
+
<|assistant|>
|
| 35 |
+
{{ visible }}
|
| 36 |
+
{%- elif role == 'assistant' and meta %}
|
| 37 |
+
<|assistant|>{{ meta }}
|
| 38 |
+
{{ visible }}
|
| 39 |
+
{%- elif role == 'observation' %}
|
| 40 |
+
<|observation|>
|
| 41 |
+
{{ visible }}
|
| 42 |
+
{%- endif %}
|
| 43 |
+
{%- endfor %}
|
| 44 |
+
{% if add_generation_prompt %}<|assistant|>
|
| 45 |
+
<think>{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Glm4ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": true,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": [
|
| 10 |
+
151329,
|
| 11 |
+
151336,
|
| 12 |
+
151338
|
| 13 |
+
],
|
| 14 |
+
"head_dim": 128,
|
| 15 |
+
"hidden_act": "silu",
|
| 16 |
+
"hidden_size": 4096,
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"intermediate_size": 13696,
|
| 19 |
+
"max_position_embeddings": 32768,
|
| 20 |
+
"model_type": "glm4",
|
| 21 |
+
"num_attention_heads": 32,
|
| 22 |
+
"num_hidden_layers": 40,
|
| 23 |
+
"num_key_value_heads": 2,
|
| 24 |
+
"pad_token_id": 151329,
|
| 25 |
+
"partial_rotary_factor": 0.5,
|
| 26 |
+
"rms_norm_eps": 1e-05,
|
| 27 |
+
"rope_parameters": {
|
| 28 |
+
"partial_rotary_factor": 0.5,
|
| 29 |
+
"rope_theta": 10000.0,
|
| 30 |
+
"rope_type": "default"
|
| 31 |
+
},
|
| 32 |
+
"tie_word_embeddings": false,
|
| 33 |
+
"transformers_version": "5.6.0",
|
| 34 |
+
"use_cache": true,
|
| 35 |
+
"vocab_size": 151552
|
| 36 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
151329,
|
| 5 |
+
151336,
|
| 6 |
+
151338
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151329,
|
| 9 |
+
"transformers_version": "5.6.0"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d8363980fe452863ec4745294edde75961a16777098ffc9633f6f9490d38c2cd
|
| 3 |
+
size 18800619048
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:76ebeac0d8bd7879ead7b43c16b44981f277e47225de2bd7de9ae1a6cc664a8c
|
| 3 |
+
size 19966496
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"clean_up_tokenization_spaces": false,
|
| 4 |
+
"do_lower_case": false,
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"extra_special_tokens": [
|
| 7 |
+
"<|user|>",
|
| 8 |
+
"<|observation|>"
|
| 9 |
+
],
|
| 10 |
+
"is_local": true,
|
| 11 |
+
"local_files_only": false,
|
| 12 |
+
"model_input_names": [
|
| 13 |
+
"input_ids",
|
| 14 |
+
"attention_mask"
|
| 15 |
+
],
|
| 16 |
+
"model_max_length": 128000,
|
| 17 |
+
"pad_token": "<|endoftext|>",
|
| 18 |
+
"padding_side": "right",
|
| 19 |
+
"remove_space": false,
|
| 20 |
+
"split_special_tokens": false,
|
| 21 |
+
"tokenizer_class": "TokenizersBackend"
|
| 22 |
+
}
|