Improve model card: Add metadata, links, and usage example
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
|
| 5 |
-
|
| 6 |
# Introduction to TraDo
|
| 7 |
|
| 8 |
-
[Paper](https://
|
| 9 |
|
| 10 |
We introduce **TraDo**, SOTA diffusion language model, trained with **TraceRL**.
|
| 11 |
|
| 12 |
-
*
|
| 13 |
-
*
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
<p align="center">
|
| 18 |
<img src="https://github.com/yinjjiew/Data/raw/main/dllm-rl/figure1.png" width="100%"/>
|
|
@@ -23,8 +22,44 @@ We introduce **TraDo**, SOTA diffusion language model, trained with **TraceRL**.
|
|
| 23 |
<img src="https://github.com/yinjjiew/Data/raw/main/dllm-rl/maintable.png" width="100%"/>
|
| 24 |
</p>
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# Citation
|
| 30 |
|
|
@@ -37,4 +72,16 @@ We introduce **TraDo**, SOTA diffusion language model, trained with **TraceRL**.
|
|
| 37 |
}
|
| 38 |
```
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
library_name: transformers
|
| 5 |
---
|
| 6 |
|
|
|
|
| 7 |
# Introduction to TraDo
|
| 8 |
|
| 9 |
+
[Paper](https://huggingface.co/papers/2509.06949) | [Code](https://github.com/Gen-Verse/dLLM-RL) | [Project Page](https://huggingface.co/collections/Gen-Verse/trado-series-68beb6cd6a26c27cde9fe3af)
|
| 10 |
|
| 11 |
We introduce **TraDo**, SOTA diffusion language model, trained with **TraceRL**.
|
| 12 |
|
| 13 |
+
* **TraDo-4B-Instruct** and **TraDo-8B-Instruct** outperform similarly sized strong AR models across math reasoning tasks.
|
| 14 |
+
* **TraDo-8B-Thinking** is the first Long-CoT diffusion language model.
|
|
|
|
|
|
|
| 15 |
|
| 16 |
<p align="center">
|
| 17 |
<img src="https://github.com/yinjjiew/Data/raw/main/dllm-rl/figure1.png" width="100%"/>
|
|
|
|
| 22 |
<img src="https://github.com/yinjjiew/Data/raw/main/dllm-rl/maintable.png" width="100%"/>
|
| 23 |
</p>
|
| 24 |
|
| 25 |
+
## Sample Usage
|
| 26 |
+
|
| 27 |
+
You can download and try our model:
|
| 28 |
+
```python
|
| 29 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 30 |
+
from generate import block_diffusion_generate
|
| 31 |
+
|
| 32 |
+
model_name = "Gen-Verse/TraDo-8B-Instruct"
|
| 33 |
+
|
| 34 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 35 |
+
model_name, trust_remote_code=True, torch_dtype="float16", device_map="cuda"
|
| 36 |
+
)
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 38 |
+
|
| 39 |
+
prompt = "What's the solution of x^2 - 2x + 1 = 0\
|
| 40 |
+
Please reason step by step, and put your final answer within \\\\boxed{}.\
|
| 41 |
+
"
|
| 42 |
+
messages = [{"role": "user", "content": prompt}]
|
| 43 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 44 |
+
|
| 45 |
+
tokens = tokenizer.batch_encode_plus([text], return_tensors='pt', padding=True, truncation=True, max_length=200)
|
| 46 |
+
tokens = {k: v.to(model.device) for k, v in tokens.items()}
|
| 47 |
+
|
| 48 |
+
output_ids = block_diffusion_generate(
|
| 49 |
+
model,
|
| 50 |
+
prompt=tokens,
|
| 51 |
+
mask_id=151669,
|
| 52 |
+
gen_length=200,
|
| 53 |
+
block_length=4, denoising_steps=4,
|
| 54 |
+
temperature=1.0, top_k=0, top_p=1.0,
|
| 55 |
+
remasking_strategy="low_confidence_dynamic",
|
| 56 |
+
confidence_threshold=0.9
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=False)
|
| 60 |
+
cleaned_text = output_text.replace('<|MASK|>', '').replace('<|endoftext|>', '')
|
| 61 |
+
print(cleaned_text)
|
| 62 |
+
```
|
| 63 |
|
| 64 |
# Citation
|
| 65 |
|
|
|
|
| 72 |
}
|
| 73 |
```
|
| 74 |
|
| 75 |
+
## Acknowledgement
|
| 76 |
+
|
| 77 |
+
This work is heavily built on the following open-source models:
|
| 78 |
+
|
| 79 |
+
[SDAR](https://github.com/JetAstra/SDAR), [Dream](https://github.com/DreamLM/Dream), [LLaDA](https://github.com/ML-GSAI/LLaDA), [MMaDA](https://github.com/Gen-Verse/MMaDA/tree/main), and [Diffu-coder](https://github.com/apple/ml-diffuCoder).
|
| 80 |
+
|
| 81 |
+
these acceleration methods (engines):
|
| 82 |
+
|
| 83 |
+
[Fast-dllm](https://github.com/NVlabs/Fast-dLLM/tree/main), [jetengine](https://github.com/Labman42/JetEngine/tree/0ddc55ad3fb712b6374515b78d656f420e1a7243),
|
| 84 |
+
|
| 85 |
+
and theoretical foundations:
|
| 86 |
|
| 87 |
+
[MDLM](https://arxiv.org/pdf/2406.07524), [DiffuLLaMA](https://arxiv.org/abs/2410.17891), [Block Diffusion](https://arxiv.org/abs/2503.09573).
|