Text Generation
Transformers
Safetensors
English
CoDA
feature-extraction
text diffusion model
language model
code generation
conversational
custom_code
Instructions to use Salesforce/CoDA-v0-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/CoDA-v0-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Salesforce/CoDA-v0-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Salesforce/CoDA-v0-Instruct", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Salesforce/CoDA-v0-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Salesforce/CoDA-v0-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Salesforce/CoDA-v0-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Salesforce/CoDA-v0-Instruct
- SGLang
How to use Salesforce/CoDA-v0-Instruct 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 "Salesforce/CoDA-v0-Instruct" \ --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": "Salesforce/CoDA-v0-Instruct", "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 "Salesforce/CoDA-v0-Instruct" \ --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": "Salesforce/CoDA-v0-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Salesforce/CoDA-v0-Instruct with Docker Model Runner:
docker model run hf.co/Salesforce/CoDA-v0-Instruct
Update README.md
#2
by weiranyao - opened
README.md
CHANGED
|
@@ -8,12 +8,40 @@ tags:
|
|
| 8 |
- language model
|
| 9 |
- code generation
|
| 10 |
---
|
| 11 |
-
# CoDA: Coding LM via Diffusion Adaptation
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
## 📊 Model Details
|
| 19 |
|
|
|
|
| 8 |
- language model
|
| 9 |
- code generation
|
| 10 |
---
|
|
|
|
| 11 |
|
| 12 |
+
<p align="center">
|
| 13 |
+
<img alt="coda-logo" src="https://raw.githubusercontent.com/weirayao/CoDA/main/CoDA-logo.png">
|
| 14 |
+
</p>
|
| 15 |
|
| 16 |
+
<p align="center">
|
| 17 |
+
<a href="https://github.com/SalesforceAIResearch/CoDA"><strong>Try CoDA</strong></a> ·
|
| 18 |
+
<a href="https://github.com/SalesforceAIResearch/CoDA/blob/main/technical_report.pdf"><strong>Technical Report</strong></a> ·
|
| 19 |
+
<a href="https://huggingface.co/collections/Salesforce/coda-68d627d87921c0e28a69e340"><strong>Model Collection</strong></a> ·
|
| 20 |
+
<a href="https://github.com/SalesforceAIResearch/CoDA/blob/main/README.md"><strong>GitHub Repository</strong></a>
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+
<br>
|
| 24 |
+
|
| 25 |
+
Welcome to CoDA, Salesforce AI Research's diffusion-based language model designed for powerful code generation and bidirectional context understanding.
|
| 26 |
+
|
| 27 |
+
We're releasing CoDA as a lightweight yet capable model:
|
| 28 |
+
- `CoDA-1.7B-Instruct` — optimized for code generation tasks with bidirectional diffusion modeling (1.7B parameters)
|
| 29 |
+
- `CoDA-1.7B-Base` — diffusion foundation model with bidirectional diffusion architecture, ideal for further fine-tuning and RL training
|
| 30 |
+
|
| 31 |
+
CoDA leverages discrete diffusion processes to enable understanding of both past and future tokens, making it uniquely suited for code completion and generation tasks where context flows in both directions.
|
| 32 |
+
|
| 33 |
+
> [!NOTE]
|
| 34 |
+
> This model card is dedicated to the `CoDA-1.7B-Instruct` model. Check out our [model collection](https://huggingface.co/collections/Salesforce/coda-68d627d87921c0e28a69e340) for other variants.
|
| 35 |
+
|
| 36 |
+
# ⭐️ Highlights
|
| 37 |
+
|
| 38 |
+
* **Bidirectional Context Understanding:** Leverage discrete diffusion processes to understand both past and future tokens, enabling superior code completion.
|
| 39 |
+
* **Confidence-Guided Sampling:** Maintain competitive inference latency through intelligent sampling strategies that balance quality and speed.
|
| 40 |
+
* **Lightweight Architecture:** Achieve strong performance with only 1.7B parameters, making it accessible for researchers with limited computational resources.
|
| 41 |
+
* **Full Training Pipeline:** Complete reproducible training pipeline from pre-training to fine-tuning, enabling customization for specific domains.
|
| 42 |
+
* **Optimized for Code:** Specifically designed and trained for code generation tasks, with strong performance on HumanEval, MBPP, and other coding benchmarks.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
|
| 46 |
## 📊 Model Details
|
| 47 |
|