Automatic Speech Recognition
Transformers
Safetensors
jais_asr
text-generation
jais
ifm
arabic
arabic-dialects
speech-to-text
code-switching
diacritization
language-identification
open-weights
custom_code
Instructions to use IFM/Jais-ASR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IFM/Jais-ASR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="IFM/Jais-ASR", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IFM/Jais-ASR", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download tokenizer_config.json from IFM/Jais-ASR: direct link, hf CLI and curl.
- Browser
- Download file 5.97 kB
-
https://huggingface.co/IFM/Jais-ASR/resolve/main/tokenizer_config.json
- Command line
-
hf download hf://IFM/Jais-ASR/tokenizer_config.json
-
curl -L -o tokenizer_config.json https://huggingface.co/IFM/Jais-ASR/resolve/main/tokenizer_config.json
5.97 kB
| { | |
| "auto_map": { | |
| "AutoProcessor": "processing_jais_asr.JaisASRProcessor" | |
| }, | |
| "bos_token": "<|ifm|begin_of_text|>", | |
| "clean_up_tokenization_spaces": false, | |
| "eos_token": "<|ifm|im_end|>", | |
| "model_max_length": 32768, | |
| "pad_token": "<|ifm|begin_of_text|>", | |
| "padding_side": "left", | |
| "processor_class": "JaisASRProcessor", | |
| "tokenizer_class": "PreTrainedTokenizerFast", | |
| "chat_template": "{%- if language is defined and language is not none -%}\n {{- raise_exception(\"language is a generation-time pin. Pass it to model.generate(), the pipeline, or the API; use language_prefill here to insert a tag.\") -}}\n{%- endif -%}\n{#- ===================================================================================\n Jais-ASR — audio transcription chat template.\n\n Optional flags (keyword arguments to apply_chat_template, or\n chat_template_kwargs on a server):\n diacritics=True -> fully diacritized transcript\n code_switch=True -> keep foreign-language spans verbatim\n language_prefill=\"EG\" -> prefill the language tag (see the model card)\n An explicit system message always wins over the mode flags.\n=================================================================================== -#}\n{{- bos_token }}\n{#- ---- mode: the system message content is the switch -------------------------- -#}\n{%- set _m = namespace(modes='') -%}\n{%- if code_switch is defined and code_switch -%}\n {%- set _m.modes = '[Code-switch]' -%}\n{%- endif -%}\n{%- if diacritics is defined and diacritics -%}\n {%- set _m.modes = (_m.modes ~ ' [Diacritics]') if _m.modes else '[Diacritics]' -%}\n{%- endif -%}\n{%- set _has_system = messages and messages[0].role == 'system' -%}\n{%- if _has_system -%}\n {%- if messages[0].content is string -%}\n {%- set system_content = messages[0].content -%}\n {%- elif messages[0].content -%}\n {%- set _sys = namespace(text='') -%}\n {%- for part in messages[0].content -%}\n {%- if part.type == 'text' -%}\n {%- set _sys.text = _sys.text + part.text -%}\n {%- endif -%}\n {%- endfor -%}\n {%- set system_content = _sys.text -%}\n {%- else -%}\n {%- set system_content = '' -%}\n {%- endif -%}\n{%- else -%}\n {%- set system_content = _m.modes -%}\n{%- endif -%}\n{%- if system_content -%}\n {{- '<|ifm|im_start|>system\\n' + system_content + '<|ifm|im_end|>' }}\n{%- endif -%}\n{#- ---- turns ------------------------------------------------------------------ -#}\n{%- for message in messages -%}\n {%- if message.content is string -%}\n {%- set content = message.content -%}\n {%- elif not message.content -%}\n {%- set content = '' -%}\n {%- else -%}\n {#- content parts: {\"type\": \"audio\"} renders the audio placeholder,\n which the processor expands -#}\n {%- set _ns = namespace(text='') -%}\n {%- for part in message.content -%}\n {%- if part.type == 'audio' -%}\n {%- set _ns.text = _ns.text + '<|ifm|audio|>' -%}\n {%- elif part.type == 'text' -%}\n {%- set _ns.text = _ns.text + part.text -%}\n {%- else -%}\n {{- raise_exception(\"audio-only model: unsupported content part type '\" ~ part.type ~ \"' (use 'audio' or 'text')\") -}}\n {%- endif -%}\n {%- endfor -%}\n {%- set content = _ns.text -%}\n {%- endif -%}\n {%- if message.role == 'system' -%}\n {%- if not loop.first -%}\n {{- '<|ifm|im_start|>system\\n' + content + '<|ifm|im_end|>' }}\n {%- endif -%}\n {%- elif message.role == 'user' -%}\n {{- '<|ifm|im_start|>user\\n' + content + '<|ifm|im_end|>' }}\n {%- elif message.role == 'assistant' -%}\n {%- set thinking = message.reasoning if message.reasoning is defined and message.reasoning is string else '' -%}\n {{- '<|ifm|im_start|>assistant' }}\n {%- generation -%}\n {{- '\\n<ifm|think>\\n' + thinking + '</ifm|think>' + content }}\n {{- '<|ifm|im_end|>' -}}\n {%- endgeneration -%}\n {%- else -%}\n {{- raise_exception(\"unsupported role '\" ~ message.role ~ \"' (use system, user or assistant)\") -}}\n {%- endif -%}\n{%- endfor -%}\n{#- ---- generation prompt ------------------------------------------------------- -#}\n{%- if add_generation_prompt -%}\n {%- if enable_thinking is defined and enable_thinking -%}\n {%- if language_prefill is defined and language_prefill -%}\n {{- raise_exception(\"language_prefill= prefill is not supported with enable_thinking=True: the prefill cannot follow an open think block. Drop language_prefill= or disable thinking.\") -}}\n {%- endif -%}\n {{- '<|ifm|im_start|>assistant\\n<ifm|think>\\n' }}\n {%- else -%}\n {{- '<|ifm|im_start|>assistant\\n<ifm|think>\\n</ifm|think>' }}\n {#- language_prefill= prefills the decision tag into the prompt: a transcript is then\n guaranteed and [IFM-NoTranscript] cannot be produced. Unset = the model\n decides. To pin a language while keeping abstention, use language.LanguagePin. -#}\n {%- if language_prefill is defined and language_prefill -%}\n {%- set _tags = ['msa','en','fr','es','it','EG','SA','MA','IQ','JO','SY','QA','DZ','LB','OM','YE','TN','MR','KW','SD','LY','AE','PS','BH'] -%}\n {%- if language_prefill not in _tags -%}\n {{- raise_exception(\"language_prefill must be one of \" ~ (_tags | join(', ')) ~ \" (got '\" ~ language_prefill ~ \"'). An ISO code such as 'ar' covers several tags and cannot be prefilled; use the LanguagePin logits processor for that.\") -}}\n {%- endif -%}\n {{- '[' ~ language_prefill ~ ']' }}\n {%- endif -%}\n {%- endif -%}\n{%- endif -%}\n", | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ] | |
| } | |