Text Generation
Transformers
Safetensors
English
metadiffusion
diffusion-language-model
diffusion
transformer
language-model
autoregressive-conversion
experimental
research
150m
english
Instructions to use CodeSoft/MetaDiffusion-150M-exp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CodeSoft/MetaDiffusion-150M-exp with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CodeSoft/MetaDiffusion-150M-exp")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("CodeSoft/MetaDiffusion-150M-exp", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CodeSoft/MetaDiffusion-150M-exp with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CodeSoft/MetaDiffusion-150M-exp" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-150M-exp", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CodeSoft/MetaDiffusion-150M-exp
- SGLang
How to use CodeSoft/MetaDiffusion-150M-exp 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 "CodeSoft/MetaDiffusion-150M-exp" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-150M-exp", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "CodeSoft/MetaDiffusion-150M-exp" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-150M-exp", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CodeSoft/MetaDiffusion-150M-exp with Docker Model Runner:
docker model run hf.co/CodeSoft/MetaDiffusion-150M-exp
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,136 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
|
| 9 |
+
library_name: transformers
|
| 10 |
+
|
| 11 |
+
tags:
|
| 12 |
+
- metadiffusion
|
| 13 |
+
- diffusion-language-model
|
| 14 |
+
- diffusion
|
| 15 |
+
- transformer
|
| 16 |
+
- language-model
|
| 17 |
+
- autoregressive-conversion
|
| 18 |
+
- experimental
|
| 19 |
+
- research
|
| 20 |
+
- 150m
|
| 21 |
+
- english
|
| 22 |
---
|
| 23 |
+
|
| 24 |
+
<h1 align="center">MetaDiffusion-150M-exp</h1>
|
| 25 |
+
|
| 26 |
+
<p align="center">
|
| 27 |
+
This model is an experimental release. Do not use it in production!
|
| 28 |
+
</p>
|
| 29 |
+
|
| 30 |
+
## Architecture
|
| 31 |
+
|
| 32 |
+
MetaDiffusion-150M-exp is a diffusion language model created by converting the Supra-1.5-50M-Base-exp autoregressive model into a diffusion language model, then expanding it to approximately 150 million parameters through layer duplication before continued diffusion training.
|
| 33 |
+
|
| 34 |
+
The model retains the original tokenizer while introducing diffusion-specific components, including timestep conditioning and a learned mask token.
|
| 35 |
+
|
| 36 |
+
| Specification | Value |
|
| 37 |
+
| ----------------- | --------------------------------------- |
|
| 38 |
+
| Architecture | `MetaDiffusionForCausalLM` |
|
| 39 |
+
| Parameters | ~169.5M |
|
| 40 |
+
| Vocabulary Size | 32,001 (32,000 + MASK token) |
|
| 41 |
+
| Hidden Size | 768 |
|
| 42 |
+
| Intermediate Size | 2,112 |
|
| 43 |
+
| Layers | 16 |
|
| 44 |
+
| Attention Heads | 12 |
|
| 45 |
+
| KV Heads | 6 |
|
| 46 |
+
| Head Dimension | 64 |
|
| 47 |
+
| Context Length | 5,120 tokens |
|
| 48 |
+
| Tokenizer | Original Supra byte-level BPE tokenizer |
|
| 49 |
+
| Activation | SiLU |
|
| 50 |
+
| RoPE θ | 10,000 |
|
| 51 |
+
| Model Type | Diffusion Language Model |
|
| 52 |
+
|
| 53 |
+
## Data
|
| 54 |
+
|
| 55 |
+
Training was performed in two stages:
|
| 56 |
+
|
| 57 |
+
1. Autoregressive-to-diffusion conversion using the Supra-1.5-50M-Base-exp checkpoint
|
| 58 |
+
2. Model expansion from approximately 50M to 150M parameters via layer duplication, followed by continued diffusion pretraining.
|
| 59 |
+
|
| 60 |
+
Training schedule:
|
| 61 |
+
|
| 62 |
+
| Stage | Dataset | Steps |
|
| 63 |
+
| ---------------------------- | ----------- | ------: |
|
| 64 |
+
| Initial diffusion training | FineWeb-EDU | 100,000 |
|
| 65 |
+
| Continued diffusion training | The Pile | 50,000 |
|
| 66 |
+
|
| 67 |
+
## Benchmarks
|
| 68 |
+
|
| 69 |
+
**Evaluation:** lm-evaluation-harness (0-shot)
|
| 70 |
+
|
| 71 |
+
| Benchmark | Samples | Accuracy | Normalized Accuracy |
|
| 72 |
+
|---|---:|---:|---:|
|
| 73 |
+
| ARC-Easy | 2,376 | 38.30% | 35.40% |
|
| 74 |
+
| ARC-Challenge | 1,172 | 18.86% | 21.84% |
|
| 75 |
+
| ArithMark-3 | 1,000 | 31.30% | 31.60% |
|
| 76 |
+
|
| 77 |
+
### Average Scores
|
| 78 |
+
|
| 79 |
+
| Metric | Score |
|
| 80 |
+
|---|---:|
|
| 81 |
+
| Average Accuracy | 29.49% |
|
| 82 |
+
| Average Normalized Accuracy | 29.61% |
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
## Running the Model
|
| 86 |
+
|
| 87 |
+
This repository includes an `inference.py` script for sampling from the model.
|
| 88 |
+
|
| 89 |
+
Example:
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
python inference.py \
|
| 93 |
+
--model-path ./model.safetensors \
|
| 94 |
+
--prompt "The cat sat on the" \
|
| 95 |
+
--num-steps 256
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### Command Line Arguments
|
| 99 |
+
|
| 100 |
+
| Flag | Description | Default |
|
| 101 |
+
| ---------------------- | ----------------------------------------------------- | ---------------------------------- |
|
| 102 |
+
| `--model-path` | Path to a local checkpoint or Hugging Face repository | Required |
|
| 103 |
+
| `--prompt` | Input prompt | `"The cat sat on the"` |
|
| 104 |
+
| `--seq-len` | Number of generated tokens | `256` |
|
| 105 |
+
| `--num-steps` | Number of diffusion denoising steps | `256` |
|
| 106 |
+
| `--temperature` | Sampling temperature | `0.6` |
|
| 107 |
+
| `--repetition-penalty` | Repetition penalty | `1.5` |
|
| 108 |
+
| `--device` | `cuda` or `cpu` | `cuda` |
|
| 109 |
+
| `--watch` | Display intermediate denoising progress | Disabled |
|
| 110 |
+
| `--watch-every` | Display every N denoising iterations | `4` |
|
| 111 |
+
| `--base-model` | Tokenizer source | `SupraLabs/Supra-1.5-50M-Base-exp` |
|
| 112 |
+
|
| 113 |
+
## Generation Defaults
|
| 114 |
+
|
| 115 |
+
| Setting | Value |
|
| 116 |
+
| ------------------ | ----: |
|
| 117 |
+
| Denoising Steps | 512 |
|
| 118 |
+
| Temperature | 0.6 |
|
| 119 |
+
| Repetition Penalty | 1.5 |
|
| 120 |
+
| Re-mask Ratio | 0.1 |
|
| 121 |
+
| Max New Tokens | 512 |
|
| 122 |
+
|
| 123 |
+
## Intended Use
|
| 124 |
+
|
| 125 |
+
MetaDiffusion-150M-exp is intended for:
|
| 126 |
+
|
| 127 |
+
* Research on diffusion language models.
|
| 128 |
+
* Experiments involving autoregressive-to-diffusion conversion.
|
| 129 |
+
* Benchmarking novel diffusion language model architectures.
|
| 130 |
+
* Further finetuning and experimentation.
|
| 131 |
+
|
| 132 |
+
This release is not instruction tuned and is not intended for production deployments.
|
| 133 |
+
|
| 134 |
+
## Acknowledgements
|
| 135 |
+
|
| 136 |
+
MetaDiffusion is derived from the Supra-1.5-50M-Base-exp model. Credit goes to the Supra authors for the original autoregressive checkpoint that served as the initialization for this work. MetaDiffusion is released under the Apache-2.0 license in accordance with the licensing terms of the original Supra checkpoint.
|