Text Generation
Transformers
Safetensors
English
qwen2
text-to-cad
code-generation
cadquery
3d-modeling
reinforcement-learning
conversational
text-generation-inference
Instructions to use gudo7208/CAD-Coder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gudo7208/CAD-Coder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gudo7208/CAD-Coder") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gudo7208/CAD-Coder") model = AutoModelForCausalLM.from_pretrained("gudo7208/CAD-Coder", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gudo7208/CAD-Coder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gudo7208/CAD-Coder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gudo7208/CAD-Coder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gudo7208/CAD-Coder
- SGLang
How to use gudo7208/CAD-Coder 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 "gudo7208/CAD-Coder" \ --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": "gudo7208/CAD-Coder", "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 "gudo7208/CAD-Coder" \ --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": "gudo7208/CAD-Coder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use gudo7208/CAD-Coder with Docker Model Runner:
docker model run hf.co/gudo7208/CAD-Coder
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -19,8 +19,6 @@ library_name: transformers
|
|
| 19 |
|
| 20 |
[](https://arxiv.org/abs/2505.19713)
|
| 21 |
|
| 22 |
-
This is the reinforcement learning (GRPO) fine-tuned model for generating CadQuery code from natural language descriptions.
|
| 23 |
-
|
| 24 |
## Model Description
|
| 25 |
|
| 26 |
CAD-Coder reformulates text-to-CAD as the generation of CadQuery scripts—a Python-based, parametric CAD language. The model is trained with a two-stage pipeline:
|
|
@@ -33,7 +31,6 @@ CAD-Coder reformulates text-to-CAD as the generation of CadQuery scripts—a Pyt
|
|
| 33 |
- Generates executable CadQuery Python code from natural language
|
| 34 |
- Chain-of-Thought (CoT) reasoning for complex CAD structures
|
| 35 |
- Geometric reward optimization for accurate 3D model generation
|
| 36 |
-
- Supports diverse CAD operations beyond simple sketch-extrusion
|
| 37 |
|
| 38 |
## Usage
|
| 39 |
|
|
|
|
| 19 |
|
| 20 |
[](https://arxiv.org/abs/2505.19713)
|
| 21 |
|
|
|
|
|
|
|
| 22 |
## Model Description
|
| 23 |
|
| 24 |
CAD-Coder reformulates text-to-CAD as the generation of CadQuery scripts—a Python-based, parametric CAD language. The model is trained with a two-stage pipeline:
|
|
|
|
| 31 |
- Generates executable CadQuery Python code from natural language
|
| 32 |
- Chain-of-Thought (CoT) reasoning for complex CAD structures
|
| 33 |
- Geometric reward optimization for accurate 3D model generation
|
|
|
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|