Skip to content

ll_ocadr — Usage

ll_ocadr encodes a global, full-resolution view of an object together with tiled local chunks, projects those features into a language model’s embedding space, and lets the LLM reason over the combined tokens.

Terminal window
python ll_ocadr/run_ll_ocadr_hf.py \
--model Qwen/Qwen2-1.8B \
--mesh part.step \
--prompt "Describe this CAD part: <mesh>" \
--max-new-tokens 64
  • The <mesh> placeholder token is registered and the LM embeddings are resized at build time.
  • n_embed is derived automatically from the chosen language model.
  • --no-cropping uses the global view only; otherwise the mesh is spatially chunked into local tiles.
from ll_ocadr.run_ll_ocadr_hf import build_model_and_tokenizer, run_inference
model, tokenizer, config, processor = build_model_and_tokenizer("Qwen/Qwen2-1.8B")
text = run_inference(model, processor, tokenizer, "part.stl", "Describe <mesh>")
print(text)
mesh / STEP file
│ vllm/process/ (chunkers, mesh/STEP loaders, tokenizer glue)
GeometryNet (PointNet++ local) + ShapeNet (ViT global)
│ concatenate → MLP projector → LLM embedding space
LatticelabsOCADRForCausalLM → HF language model (forward / generate)
  • vllm/latticelabs_ocadr.pyLatticelabsOCADRForCausalLM.
  • vllm/lattice_encoder/GeometryNet, ShapeNet, MLP projector.
Terminal window
# Fast unit tests (encoders, chunkers, fixtures) — no model download:
cd ll_ocadr && pytest tests/ -m "not slow"
# End-to-end + CLI tests (tiny offline LM, still no network):
cd ll_ocadr && pytest tests/ -m slow