Text Generation
Transformers
Safetensors
qwen2_cad_state
cad
text-to-cad
world-model
qwen2
conversational
custom_code
Instructions to use AI-for-CAD/CAD-WAM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI-for-CAD/CAD-WAM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AI-for-CAD/CAD-WAM", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("AI-for-CAD/CAD-WAM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AI-for-CAD/CAD-WAM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AI-for-CAD/CAD-WAM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI-for-CAD/CAD-WAM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AI-for-CAD/CAD-WAM
- SGLang
How to use AI-for-CAD/CAD-WAM 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 "AI-for-CAD/CAD-WAM" \ --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": "AI-for-CAD/CAD-WAM", "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 "AI-for-CAD/CAD-WAM" \ --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": "AI-for-CAD/CAD-WAM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AI-for-CAD/CAD-WAM with Docker Model Runner:
docker model run hf.co/AI-for-CAD/CAD-WAM
|
Download README.md from AI-for-CAD/CAD-WAM: direct link, hf CLI and curl.
- Browser
- Download file 3.71 kB
-
https://huggingface.co/AI-for-CAD/CAD-WAM/resolve/main/README.md
- Command line
-
hf download hf://AI-for-CAD/CAD-WAM/README.md
-
curl -L -o README.md https://huggingface.co/AI-for-CAD/CAD-WAM/resolve/main/README.md
3.71 kB
| license: mit | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - cad | |
| - text-to-cad | |
| - world-model | |
| - qwen2 | |
| # CAD-WAM — stepwise text-to-CAD with a geometric world model | |
| **Anonymous artifact for a paper currently under double-blind review.** | |
| CAD-WAM generates a parametric CAD construction sequence from a natural-language description. At every | |
| step it predicts both the next construction action **and** the geometric state that action will produce, | |
| and it is re-conditioned on the solid its own actions have actually built: each predicted action is | |
| executed by a CAD kernel, the resulting solid is sampled and encoded, and that encoding is fed back as the | |
| state for the next step. | |
| - Backbone: Qwen2.5-1.5B-Instruct, extended with a **geometric state embedding** (1024-d latent → 16 | |
| input tokens) and a **state prediction head**. | |
| - Loss: action cross-entropy + `state_loss_weight` × next-state regression (this checkpoint: `0.03`). | |
| - Training data: the official DeepCAD split, converted to a step-wise action/state dataset. | |
| ## Files | |
| | file | what it is | | |
| |---|---| | |
| | `model.safetensors` | the CAD-WAM weights (BF16, 378 tensors) | | |
| | `config.json`, `generation_config.json` | architecture and decoding configuration | | |
| | `modeling_cadwam.py`, `geometric_state_embedding.py`, `state_prediction_head.py` | the model definition, loaded through `trust_remote_code=True` | | |
| | tokenizer files | unchanged from the backbone, plus the geometric placeholder token | | |
| | `setvae_encoder/setvae_encoder.pt` | the SetVAE point-cloud encoder that produces the 1024-d geometric state (6.4 M parameters) | | |
| ## Loading | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| tok = AutoTokenizer.from_pretrained("<repo-id>") | |
| model = AutoModelForCausalLM.from_pretrained( | |
| "<repo-id>", trust_remote_code=True, dtype="bfloat16" | |
| ).eval() | |
| ``` | |
| Requires `transformers >= 4.51` (the model definition imports the Qwen3 classes at module scope); | |
| verified with 4.57.6, the version the checkpoint was trained under. | |
| The model is **not** a plain text-to-text model. A forward pass expects a `geo_latent` tensor of shape | |
| `(batch, 1024)` alongside `input_ids`, and the prompt must contain the geometric placeholder token at the | |
| 16 positions reserved for the state. Encoding a solid into that latent requires the SetVAE encoder in | |
| `setvae_encoder/`; its architecture, the point-cloud sampling, the CAD kernel executor and the closed-loop | |
| rollout are in the anonymous code repository linked from the review discussion. | |
| For the first step of a construction the state is the empty model, whose latent is the encoder's | |
| representation of an empty point set. | |
| A forward pass returns `logits`, `pred_next_state` (the predicted next geometric state, `(batch, 1024)`), | |
| `last_hidden_state`, `geo_hidden_states` and `state_repr`. | |
| ## Intended use and limitations | |
| Research artifact for reproducing the paper's results. The action vocabulary covers sketch-and-extrude | |
| modelling (lines, arcs and circles in a sketch plane, extrusion with boolean union, cut and new-body | |
| operations); fillet, chamfer, revolve and sketches on created faces are **not** part of this checkpoint's | |
| representation. Generations are only as valid as the kernel confirms: an action that fails to produce a | |
| solid is rejected during rollout rather than silently accepted. | |
| The checkpoint was trained and evaluated on one corpus of mechanical parts and should not be expected to | |
| transfer to organic shapes, assemblies or drawings. | |
| ## License | |
| MIT for the released weights and code in this repository. The backbone is Qwen2.5-1.5B-Instruct | |
| (Apache-2.0); the training data derives from a public CAD corpus under its own terms. | |