Instructions to use eustlb/GLM-ASR-Nano-2512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eustlb/GLM-ASR-Nano-2512 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eustlb/GLM-ASR-Nano-2512") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoProcessor, AutoModelForSeq2SeqLM processor = AutoProcessor.from_pretrained("eustlb/GLM-ASR-Nano-2512") model = AutoModelForSeq2SeqLM.from_pretrained("eustlb/GLM-ASR-Nano-2512") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use eustlb/GLM-ASR-Nano-2512 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eustlb/GLM-ASR-Nano-2512" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eustlb/GLM-ASR-Nano-2512", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/eustlb/GLM-ASR-Nano-2512
- SGLang
How to use eustlb/GLM-ASR-Nano-2512 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 "eustlb/GLM-ASR-Nano-2512" \ --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": "eustlb/GLM-ASR-Nano-2512", "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 "eustlb/GLM-ASR-Nano-2512" \ --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": "eustlb/GLM-ASR-Nano-2512", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use eustlb/GLM-ASR-Nano-2512 with Docker Model Runner:
docker model run hf.co/eustlb/GLM-ASR-Nano-2512
Upload processor
Browse files- chat_template.jinja +37 -0
- processor_config.json +20 -0
- tokenizer.json +0 -0
- tokenizer_config.json +32 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro to_text(content) -%}
|
| 2 |
+
{%- if content is string -%}
|
| 3 |
+
{{- content -}}
|
| 4 |
+
{%- elif content is iterable and content is not mapping -%}
|
| 5 |
+
{%- for item in content -%}
|
| 6 |
+
{%- if item is mapping and item.type == 'text' and item.text is defined -%}
|
| 7 |
+
{{- item.text -}}
|
| 8 |
+
{%- elif item is mapping and (item.type == 'audio' or 'audio' in item) -%}
|
| 9 |
+
<|begin_of_audio|><|pad|><|end_of_audio|><|user|>
|
| 10 |
+
{% elif item is string -%}
|
| 11 |
+
{{- item -}}
|
| 12 |
+
{%- endif -%}
|
| 13 |
+
{%- endfor -%}
|
| 14 |
+
{%- else -%}
|
| 15 |
+
{{- content -}}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- endmacro -%}
|
| 18 |
+
|
| 19 |
+
{%- for m in messages -%}
|
| 20 |
+
{%- if m.role == 'system' -%}
|
| 21 |
+
<|system|>
|
| 22 |
+
{{ to_text(m.content) | trim }}
|
| 23 |
+
|
| 24 |
+
{%- elif m.role == 'user' -%}
|
| 25 |
+
<|user|>
|
| 26 |
+
{{ to_text(m.content) | trim }}
|
| 27 |
+
|
| 28 |
+
{%- elif m.role == 'assistant' -%}
|
| 29 |
+
<|assistant|>
|
| 30 |
+
{{ to_text(m.content) | trim }}
|
| 31 |
+
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
{%- endfor -%}
|
| 34 |
+
|
| 35 |
+
{%- if add_generation_prompt -%}
|
| 36 |
+
<|assistant|>
|
| 37 |
+
{% endif -%}
|
processor_config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_bos_token": "<|begin_of_audio|>",
|
| 3 |
+
"audio_eos_token": "<|end_of_audio|>",
|
| 4 |
+
"audio_token": "<|pad|>",
|
| 5 |
+
"feature_extractor": {
|
| 6 |
+
"chunk_length": 30,
|
| 7 |
+
"dither": 0.0,
|
| 8 |
+
"feature_extractor_type": "WhisperFeatureExtractor",
|
| 9 |
+
"feature_size": 128,
|
| 10 |
+
"hop_length": 160,
|
| 11 |
+
"n_fft": 400,
|
| 12 |
+
"n_samples": 480000,
|
| 13 |
+
"nb_max_frames": 3000,
|
| 14 |
+
"padding_side": "right",
|
| 15 |
+
"padding_value": 0.0,
|
| 16 |
+
"return_attention_mask": false,
|
| 17 |
+
"sampling_rate": 16000
|
| 18 |
+
},
|
| 19 |
+
"processor_class": "GlmasrProcessor"
|
| 20 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"clean_up_tokenization_spaces": false,
|
| 4 |
+
"do_lower_case": false,
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"extra_special_tokens": [
|
| 7 |
+
"<|endoftext|>",
|
| 8 |
+
"[MASK]",
|
| 9 |
+
"[gMASK]",
|
| 10 |
+
"[sMASK]",
|
| 11 |
+
"<sop>",
|
| 12 |
+
"<eop>",
|
| 13 |
+
"<|system|>",
|
| 14 |
+
"<|user|>",
|
| 15 |
+
"<|assistant|>",
|
| 16 |
+
"<|observation|>",
|
| 17 |
+
"<|begin_of_image|>",
|
| 18 |
+
"<|end_of_image|>"
|
| 19 |
+
],
|
| 20 |
+
"is_local": false,
|
| 21 |
+
"model_input_names": [
|
| 22 |
+
"input_ids",
|
| 23 |
+
"attention_mask"
|
| 24 |
+
],
|
| 25 |
+
"model_max_length": 65536,
|
| 26 |
+
"model_specific_special_tokens": {},
|
| 27 |
+
"pad_token": "<|endoftext|>",
|
| 28 |
+
"padding_side": "left",
|
| 29 |
+
"processor_class": "GlmasrProcessor",
|
| 30 |
+
"remove_space": false,
|
| 31 |
+
"tokenizer_class": "TokenizersBackend"
|
| 32 |
+
}
|