Text Generation
Transformers
Safetensors
llada2_moe
dllm
diffusion
llm
text_generation
conversational
custom_code
Eval Results
Run this model with HF Jobs
Run inclusionAI/LLaDA2.1-flash on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/inclusionAI/LLaDA2.1-flash. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/inclusionAI/LLaDA2.1-flash on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/inclusionAI/LLaDA2.1-flash. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/inclusionAI/LLaDA2.1-flash. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use inclusionAI/LLaDA2.1-flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/LLaDA2.1-flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="inclusionAI/LLaDA2.1-flash", 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("inclusionAI/LLaDA2.1-flash", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use inclusionAI/LLaDA2.1-flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inclusionAI/LLaDA2.1-flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inclusionAI/LLaDA2.1-flash", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/inclusionAI/LLaDA2.1-flash
- SGLang
How to use inclusionAI/LLaDA2.1-flash 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 "inclusionAI/LLaDA2.1-flash" \ --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": "inclusionAI/LLaDA2.1-flash", "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 "inclusionAI/LLaDA2.1-flash" \ --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": "inclusionAI/LLaDA2.1-flash", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use inclusionAI/LLaDA2.1-flash with Docker Model Runner:
docker model run hf.co/inclusionAI/LLaDA2.1-flash
Add files using upload-large-folder tool
Browse filesFiles changed (38)
- config.jsonAdded+56
- configuration_llada2_moe.pyAdded+87
- model-00000-of-00032.safetensorsAdded+3
- model-00001-of-00032.safetensorsAdded+3
- model-00002-of-00032.safetensorsAdded+3
- model-00003-of-00032.safetensorsAdded+3
- model-00004-of-00032.safetensorsAdded+3
- model-00005-of-00032.safetensorsAdded+3
- model-00006-of-00032.safetensorsAdded+3
- model-00007-of-00032.safetensorsAdded+3
- model-00008-of-00032.safetensorsAdded+3
- model-00009-of-00032.safetensorsAdded+3
- model-00010-of-00032.safetensorsAdded+3
- model-00011-of-00032.safetensorsAdded+3
- model-00012-of-00032.safetensorsAdded+3
- model-00013-of-00032.safetensorsAdded+3
- model-00014-of-00032.safetensorsAdded+3
- model-00015-of-00032.safetensorsAdded+3
- model-00016-of-00032.safetensorsAdded+3
- model-00017-of-00032.safetensorsAdded+3
- model-00018-of-00032.safetensorsAdded+3
- model-00019-of-00032.safetensorsAdded+3
- model-00020-of-00032.safetensorsAdded+3
- model-00021-of-00032.safetensorsAdded+3
- model-00022-of-00032.safetensorsAdded+3
- model-00023-of-00032.safetensorsAdded+3
- model-00024-of-00032.safetensorsAdded+3
- model-00025-of-00032.safetensorsAdded+3
- model-00026-of-00032.safetensorsAdded+3
- model-00027-of-00032.safetensorsAdded+3
- model-00028-of-00032.safetensorsAdded+3
- model-00029-of-00032.safetensorsAdded+3
- model-00030-of-00032.safetensorsAdded+3
- model-00031-of-00032.safetensorsAdded+3
- model.safetensors.index.jsonAdded
- special_tokens_map.jsonAdded+8
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+18
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556{ "architectures": [ "LLaDA2MoeModelLM" ], "attention_dropout": 0.0, "auto_map": { "AutoConfig": "configuration_llada2_moe.LLaDA2MoeConfig", "AutoModel": "modeling_llada2_moe.LLaDA2MoeModel", "AutoModelForCausalLM": "modeling_llada2_moe.LLaDA2MoeModelLM" }, "embedding_dropout": 0.0, "first_k_dense_replace": 1, "head_dim": 128, "hidden_act": "silu", "hidden_size": 4096, "initializer_range": 0.02, "intermediate_size": 9216, "max_position_embeddings": 32768, "max_window_layers": 28, "model_type": "llada2_moe", "moe_intermediate_size": 1024, "moe_router_enable_expert_bias": true, "n_group": 8, "norm_head": false, "norm_softmax": false, "norm_topk_prob": true, "num_attention_heads": 32, "num_experts": 256, "num_experts_per_tok": 8, "num_hidden_layers": 32, "num_key_value_heads": 4, "num_shared_experts": 1, "output_dropout": 0.0, "output_router_logits": false, "pad_token_id": 156892, "partial_rotary_factor": 0.5, "rms_norm_eps": 1e-06, "rope_scaling": null, "rope_theta": 600000, "rotary_dim": 64, "routed_scaling_factor": 2.5, "router_dtype": "fp32", "score_function": "sigmoid", "sliding_window": 4096, "tie_word_embeddings": false, "topk_group": 4, "torch_dtype": "bfloat16", "transformers_version": "4.51.0", "use_bias": false, "use_cache": false, "use_qkv_bias": false, "use_rmsnorm": true, "use_sliding_window": false, "using_split_qkv_in_self_attention": false, "vocab_size": 157184}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687"""LLaDA2 MoE model configuration"""
from transformers.configuration_utils import PretrainedConfig
class LLaDA2MoeConfig(PretrainedConfig): model_type = "llada2_moe"
def __init__( self, vocab_size=30592, hidden_size=1024, intermediate_size=None, num_hidden_layers=24, num_attention_heads=16, num_key_value_heads=0, hidden_act="silu", use_qkv_bias=False, # llada2 only use_qk_norm=False, use_bias=True, # llada2 only rms_norm_eps=1e-05, norm_head=False, # llada2 only tie_word_embeddings=False, # PretrainedConfig key, here change default value. embedding_dropout=0.1, attention_dropout=0.1, output_dropout=0.1, initializer_range=0.02, max_position_embeddings=16384, rope_theta=10000.0, use_cache=True, use_sliding_window=False, sliding_window=4096, max_window_layers=28, rope_scaling=None, pad_token_id=126081, num_experts=16, num_shared_experts=0, num_experts_per_tok=2, n_group=8, topk_group=4, routed_scaling_factor=2.5, moe_intermediate_size=None, first_k_dense_replace=0, head_dim=None, output_router_logits=False, partial_rotary_factor=0.5, **kwargs, ): self.num_hidden_layers = num_hidden_layers self.vocab_size = vocab_size self.hidden_size = hidden_size self.intermediate_size = intermediate_size self.num_attention_heads = num_attention_heads self.num_key_value_heads = num_key_value_heads self.hidden_act = hidden_act self.use_qkv_bias = use_qkv_bias self.use_bias = use_bias self.norm_head = norm_head self.rms_norm_eps = rms_norm_eps self.embedding_dropout = embedding_dropout self.attention_dropout = attention_dropout self.output_dropout = output_dropout self.initializer_range = initializer_range self.max_position_embeddings = max_position_embeddings self.rope_theta = rope_theta self.use_cache = use_cache self.use_sliding_window = use_sliding_window self.sliding_window = sliding_window self.max_window_layers = max_window_layers self.head_dim = head_dim or self.hidden_size // self.num_attention_heads self.rope_scaling = rope_scaling
# MoE configs self.num_experts = num_experts self.num_shared_experts = num_shared_experts self.num_experts_per_tok = num_experts_per_tok self.n_group = n_group self.topk_group = topk_group self.moe_intermediate_size = moe_intermediate_size self.first_k_dense_replace = first_k_dense_replace self.output_router_logits = output_router_logits self.routed_scaling_factor = routed_scaling_factor self.partial_rotary_factor = partial_rotary_factor
super().__init__( pad_token_id=pad_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs )123version https://git-lfs.github.com/spec/v1oid sha256:10965f0e94973dc1fa9d67145dc94111de4968773c2d6818f0e95bb028c79d63size 12304705856123version https://git-lfs.github.com/spec/v1oid sha256:1e0372da86b06d5576c018ae3b87303b1f36487df00b3e2781625fde0eb9f4e1size 6241216968123version https://git-lfs.github.com/spec/v1oid sha256:abac975420bcf2efdfb6efed606b3ac0d81bdf9fa5b81345d8b0ba4f371baecfsize 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:9f217442742299465f0a566ee88d1e1cccaa6468819d47f83db525bc7aaab0f7size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:f1286fad6e4bc073032fa0e1b5a5db65379bbd0d10d39fc88cced5f359e22f58size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:76346ead4a40f1807cc936a74a533ca9dee41491c39611bfbb39aef14d8cd867size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:3a303fd89fb0032678611173650ceb96194e6d0a07849fabed6d77ea3a3977a6size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:fce8de55ca6bc0dfc7802277469684f39ba194774660919dfd3db91c8f54881asize 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:d4f7d73bcc9978fce9f47176e3b6ef7db7020260797564dee6b4438558ae4a92size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:173e0de554b570c888b8a55ab1ce6dfaf2c11ce64fc2f7cfd698611e7ae258d7size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:81022aa01f59b3e43e956824f493dda0ce2d6831fcf41a0bfd84420d95fa405asize 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:88e0f3cf742a046a69b74b944115003755e58a76e4016efd17d4aad2999c6d42size 6241217160123version https://git-lfs.github.com/spec/v1oid sha256:1cfd06ffecce41f386579ec03272e2742a6326e917ba1793ffb79928e5ad9696size 6241217528123version https://git-lfs.github.com/spec/v1oid sha256:1ac6464d1fc6786c52445e2b24400b0eafd3ed4ed42ffb4e02e5b7d47a5d3383size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:fd08bc4259afdf0bdb6841c70ba2abc90f1e08017a691d6751bd786a0c6209b3size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:698b260559ffb7465f16d535a3fb2be0518ee02165da641c0ed835e1c8c9996csize 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:b63b86618367304565a7b688d2cc1a0452b97e63bfc3b0d59a12923861abd1d1size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:86835b11658f8727429590cf3663ebaccbc808af2668c7da8c2e05d33800e310size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:deb65b6879454d0fd42cbed635feabcf7bb56507fc954e60eaa705d11358e482size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:49dfac039fd28ca93d27f5c5ce3efacb98096f28e432007d0ca87203b3c693b3size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:62b565d51b5a66aecd0eaecdb43ab01543d64c4bb71a8a99c59b5ff676507e4bsize 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:d008e619c43d299b71407e1e042fba557f3ab873053d0c4b32807bc5bf09eb53size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:90c1dfa83a5ab87348a01753686d90fc836da7487bb7d77636b256a4dc50f8a1size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:922bb51c33bcfb7c8c69df77d0d57c4b547afa4480a3a7123e86a01f03d0ace4size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:9c71d5046bd8bd53e3a8098bda7d8bca9940389f3e3a2bfb3698bfd638b6dec4size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:3d19b5d22919b528fd3bca507e06e18fe21de0e310b1a537d830bacb4372cb47size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:cfe07be1d92e30808d47cf25d5b9ea9b38e0ca82bbe710079fd59a3a3eb4dde0size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:6a3e0c627ce019c475ff60453d5cc4ba1cbef07ad83d78081a0bbcf2190aa6a3size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:d625336dd7492247b793a1adc9c742f5c342802a8be49f91467a3702d5c07ce3size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:9106678a97b1aac299cf0768a75e74947db9b6dffa761e9ce630ba86d2bc27f7size 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:493beefdbd25a1012cbdb2505a3872e489a1ce49b2871d599dfadaf39834008bsize 6241217904123version https://git-lfs.github.com/spec/v1oid sha256:5fd0d4b4d88d6499d7a4ff6521875a9c816ffb497254b5a2cc93f118eaab7ce1size 624121790412345678{ "bos_token": "<|startoftext|>", "cls_token": "[CLS]", "eos_token": "<|endoftext|>", "gmask_token": "[gMASK]", "pad_token": "<|endoftext|>", "mask_token": "<|mask|>"}123456789101112131415161718{ "add_bos_token": false, "add_eos_token": false, "bos_token": "<|startoftext|>", "chat_template": "{% set thinking_option = 'off' %}\n{{- '<role>SYSTEM</role>' }}\n{%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n' }}\n{%- endif %}\n{%- if tools %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call>\\n\" }}\n{%- endif %}\n{{- 'detailed thinking ' + thinking_option + '<|role_end|>' }}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if message.role == \"user\" %}\n {{- '<role>HUMAN</role>' + message.content + '<|role_end|>' }}\n {%- elif message.role == \"system\" and not loop.first %}\n {{- '<role>SYSTEM</role>' + message.content + '<|role_end|>' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if reasoning_content %}\n {{- '<role>ASSISTANT</role>' + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<role>ASSISTANT</role>' + content }}\n {%- endif %}\n {%- else %}\n {{- '<role>ASSISTANT</role>' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|role_end|>' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<role>OBSERVATION</role>' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|role_end|>' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<role>ASSISTANT</role>' }}\n{%- endif %}", "clean_up_tokenization_spaces": false, "cls_token": "[CLS]", "eos_token": "<|endoftext|>", "mask_token": "<|mask|>", "fast_tokenizer": true, "gmask_token": "[gMASK]", "merges_file": null, "model_max_length": 32768, "pad_token": "<|endoftext|>", "tokenizer_class": "PreTrainedTokenizerFast", "trust_remote_code": true, "vocab_file": null}config.jsonAdded+56
configuration_llada2_moe.pyAdded+87
model-00000-of-00032.safetensorsAdded+3
model-00001-of-00032.safetensorsAdded+3
model-00002-of-00032.safetensorsAdded+3
model-00003-of-00032.safetensorsAdded+3
model-00004-of-00032.safetensorsAdded+3
model-00005-of-00032.safetensorsAdded+3
model-00006-of-00032.safetensorsAdded+3
model-00007-of-00032.safetensorsAdded+3
model-00008-of-00032.safetensorsAdded+3
model-00009-of-00032.safetensorsAdded+3
model-00010-of-00032.safetensorsAdded+3
model-00011-of-00032.safetensorsAdded+3
model-00012-of-00032.safetensorsAdded+3
model-00013-of-00032.safetensorsAdded+3
model-00014-of-00032.safetensorsAdded+3
model-00015-of-00032.safetensorsAdded+3
model-00016-of-00032.safetensorsAdded+3
model-00017-of-00032.safetensorsAdded+3
model-00018-of-00032.safetensorsAdded+3
model-00019-of-00032.safetensorsAdded+3
model-00020-of-00032.safetensorsAdded+3
model-00021-of-00032.safetensorsAdded+3
model-00022-of-00032.safetensorsAdded+3
model-00023-of-00032.safetensorsAdded+3
model-00024-of-00032.safetensorsAdded+3
model-00025-of-00032.safetensorsAdded+3
model-00026-of-00032.safetensorsAdded+3
model-00027-of-00032.safetensorsAdded+3
model-00028-of-00032.safetensorsAdded+3
model-00029-of-00032.safetensorsAdded+3
model-00030-of-00032.safetensorsAdded+3
model-00031-of-00032.safetensorsAdded+3
model.safetensors.index.jsonAdded
special_tokens_map.jsonAdded+8
tokenizer.jsonAdded
tokenizer_config.jsonAdded+18