Buckets:
15.2 GB
22 files
Updated 15 days ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .gitattributes | 1.52 kB xet | 818ba6de | |
| README.md | 2.26 kB xet | f2d9c81f | |
| added_tokens.json | 681 Bytes xet | 6edb1564 | |
| chat_template.jinja | 2.43 kB xet | 8a2b5062 | |
| config.json | 879 Bytes xet | 61c0ba36 | |
| configuration_dream.py | 3.2 kB xet | 9ede1af7 | |
| generation_config.json | 331 Bytes xet | 53771b6e | |
| generation_utils.py | 22.3 kB xet | ed004945 | |
| merges.txt | 1.67 MB xet | 87912eed | |
| model-00001-of-00004.safetensors | 4.88 GB xet | 266987f5 | |
| model-00002-of-00004.safetensors | 4.93 GB xet | a9b6e3d3 | |
| model-00003-of-00004.safetensors | 4.33 GB xet | 408dc2c3 | |
| model-00004-of-00004.safetensors | 1.09 GB xet | a39de6c8 | |
| model.safetensors.index.json | 27.8 kB xet | 902da5a0 | |
| modeling_dream.py | 36.8 kB xet | e5e0ae6d | |
| special_tokens_map.json | 677 Bytes xet | 65bca850 | |
| tokenization_dream.py | 14 kB xet | 072997d0 | |
| tokenizer_config.json | 5.14 kB xet | 7a51abb2 | |
| train_results.json | 201 Bytes xet | 80b475fb | |
| trainer_state.json | 367 kB xet | c2115546 | |
| training_args.bin | 8.38 kB xet | 43a9653b | |
| vocab.json | 3.38 MB xet | ec43576e |
DiffuCoder-7B-cpGRPO
The DiffuCoder-7B-cpGRPO variant further refines DiffuCoder-Instruct with reinforcement learning via Coupled-GRPO.
Training recipe:
- Initialized from DiffuCoder-7B-Instruct, post-training with coupled-GRPO on 21K code data (1 epoch).
- coupled-GRPO significantly improves DiffuCoder's performance on code generation benchmarks (+4.4% on EvalPlus) and reduces reliance on AR bias during decoding.
More details and usage examples:
import torch
from transformers import AutoModel, AutoTokenizer
model_path = "apple/DiffuCoder-7B-cpGRPO"
model = AutoModel.from_pretrained(model_path, torch_dtype=torch.bfloat16, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = model.to("cuda").eval()
query = "Write a function to find the shared elements from the given two lists."
prompt = f"""<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
{query.strip()}
<|im_end|>
<|im_start|>assistant
""" ## following the template of qwen; you can also use apply_chat_template function
TOKEN_PER_STEP = 1 # diffusion timesteps * TOKEN_PER_STEP = total new tokens
inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs.input_ids.to(device="cuda")
attention_mask = inputs.attention_mask.to(device="cuda")
output = model.diffusion_generate(
input_ids,
attention_mask=attention_mask,
max_new_tokens=256,
output_history=True,
return_dict_in_generate=True,
steps=256//TOKEN_PER_STEP,
temperature=0.4,
top_p=0.95,
alg="entropy",
alg_temp=0.,
)
generations = [
tokenizer.decode(g[len(p) :].tolist())
for p, g in zip(input_ids, output.sequences)
]
print(generations[0].split('<|dlm_pad|>')[0])
Acknowledgement
To power this HuggingFace model release, we reuse Dream's modeling architecture and generation utils.
- Total size
- 15.2 GB
- Files
- 22
- Last updated
- Nov 3
- Pre-warmed CDN
- US EU US EU