tucian commited on
Commit
249726d
·
verified ·
1 Parent(s): 849a848

add model card

Browse files
Files changed (1) hide show
  1. README.md +26 -47
README.md CHANGED
@@ -1,60 +1,39 @@
1
  ---
2
- license: apache-2.0
3
- language:
4
- - code
5
- library_name: transformers
6
  tags:
7
  - masked-diffusion
8
- - code-generation
9
  - qwen2
 
 
 
 
10
  ---
11
 
12
- ## thunder-dlm-0.6b — Masked Diffusion Model for Code Generation
13
 
14
- This repository contains the weights and custom code for the **staticlabs/thunder-dlm-0.6b** model, a masked diffusion model for code generation based on the Qwen2 architecture.
15
 
16
- This model uses bidirectional attention and must be used with the custom `diffusion_generate` method.
17
 
18
- ## How to Use
19
 
20
- First, make sure you have the latest `transformers` library installed.
 
 
 
 
 
 
21
 
22
- ```bash
23
- pip install transformers torch huggingface_hub
24
- ```
25
 
26
- You can then use the model for generation. Note: You must pass trust_remote_code=True to load the custom model architecture.
27
- ```python
28
- import torch
29
- from transformers import AutoTokenizer, AutoModelForCausalLM
30
-
31
- model_id = "staticlabs/thunder-dlm-0.6b"
32
- device = "cuda" if torch.cuda.is_available() else "cpu"
33
-
34
- # trust_remote_code=True is essential
35
- tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
36
- model = AutoModelForCausalLM.from_pretrained(
37
- model_id,
38
- torch_dtype=torch.bfloat16,
39
- trust_remote_code=True
40
- ).to(device)
41
-
42
- prompt = "def fibonacci(n):"
43
- input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
44
-
45
- # The model will use the generation_config.json from the repo by default
46
- # You can also override parameters here
47
- outputs = model.diffusion_generate(
48
- inputs=input_ids,
49
- max_new_tokens=100,
50
- steps=16,
51
- temperature=0.8
52
- )
53
-
54
- # Decode the output
55
- prompt_len = input_ids.shape[1]
56
- generated_text = tokenizer.decode(outputs.sequences[0][prompt_len:], skip_special_tokens=True)
57
-
58
- print("--- Generated Code ---")
59
- print(generated_text)
60
  ```
 
 
 
 
 
1
  ---
 
 
 
 
2
  tags:
3
  - masked-diffusion
4
+ - diffusion
5
  - qwen2
6
+ - code
7
+ language:
8
+ - en
9
+ pipeline_tag: text-generation
10
  ---
11
 
12
+ # dlm-code0.6b-exp
13
 
14
+ **Experimental** masked-diffusion language model for code, from the [thunder-fast](https://github.com/AdrianTuci1/thunder-fast) project.
15
 
16
+ This is a **discrete masked-diffusion (MDM)** adaptation of a Qwen2-based pretrained code model (~0.5B). It is *not* an autoregressive next-token model: generation is a progressive un-masking loop under **bidirectional attention**, so a whole output window is filled in parallel over 24 diffusion steps.
17
 
18
+ ## Details
19
 
20
+ | | |
21
+ |---|---|
22
+ | Backbone | Qwen2 (`model_type: qwen2`), 24 layers, hidden 896, 14 attention / 2 KV heads, GQA |
23
+ | Vocabulary | 151,936 + `<M>` mask token (id 151665) |
24
+ | Diffusion | discrete `[MASK]`, 24-step progressive un-masking, entropy-based position confidence (`alg_temp` 0.6, `top_k` 500) |
25
+ | Context | window-based (256 tokens) — not left-to-right; supports infilling |
26
+ | Weights | bf16 (`model.safetensors`) |
27
 
28
+ ## How to run
 
 
29
 
30
+ This checkpoint is intended to be driven by a **diffusion decoder** (bidirectional attention + the iterative un-masking loop), e.g. the thunder-fast runtime. Loading it as a plain causal `Qwen2ForCausalLM` will *not* reproduce diffusion generation.
31
+
32
+ ```
33
+ # thunder-fast runtime (ggml engine) or the reference DiffusionLM
34
+ # e.g. runtime --model dlm-code0.6b-exp.gguf --prompt "..."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  ```
36
+
37
+ ## Status
38
+
39
+ Experimental / work-in-progress (`.exp`). It is a diffusion code-generation checkpoint published for the thunder-fast project; see the repo for training, the masking schedule, and evaluation details.