You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

InternVL2-8B GenCAD-Code Fine-tuned (v2)

An InternVL2-8B model fine-tuned to generate CadQuery Python code from 3D CAD model images.

Model Details

  • Base Model: OpenGVLab/InternVL2-8B
  • Fine-tuning Data: CADCODER/GenCAD-Code 10,000 samples (extracted from 147K)
  • Training: Full fine-tuning (no LoRA), 3 epochs, best at epoch 2
  • Best Validation Loss: 0.1487
  • Hardware: 4x NVIDIA RTX 6000 Ada (48GB each)
  • Training Framework: aiDaptive (Phison)

Performance

50-sample evaluation (stratified sampling from eval.json, unseen during training):

Metric Base Model Fine-tuned (v2) Improvement
Average Loss 1.166 0.192 -83.5%
Python Syntax Valid 34/50 47/50 +38%
CadQuery Execution 1/50 46/50 +4500%
Solid Generation 0/50 46/50 -
STL Export 0/50 46/50 -

Training Configuration (v2)

Parameter Value
Learning Rate 5e-6 (Cosine Annealing)
Effective Batch Size 32 (1/GPU ร— 4GPU ร— grad_accum=8)
Epochs 3
Max Sequence Length 4096
Weight Decay 0.05
Precision bf16
Early Stopping patience=2, min_delta=0.005

Usage

import torch
from transformers import AutoTokenizer, AutoModel
from PIL import Image

model_path = "Nextorage/InternVL2-8B-GenCAD-Code-v2"
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained(
    model_path,
    torch_dtype=torch.bfloat16,
    trust_remote_code=True,
).eval().cuda()

# System prompt
system_prompt = (
    "ใ‚ใชใŸใฏCADใ‚ณใƒผใƒ‰็”Ÿๆˆใ‚ขใ‚ทใ‚นใ‚ฟใƒณใƒˆใงใ™ใ€‚"
    "3D CADใƒขใƒ‡ใƒซใฎ็”ปๅƒใŒไธŽใˆใ‚‰ใ‚ŒใŸๅ ดๅˆใ€ใใฎใƒขใƒ‡ใƒซใ‚’ๅ†็พใ™ใ‚‹ "
    "CadQuery Pythonใ‚ณใƒผใƒ‰ใ‚’็”Ÿๆˆใ—ใฆใใ ใ•ใ„ใ€‚"
    "่ชฌๆ˜Žใฏไธ่ฆใงใ™ใ€‚ใ‚ณใƒผใƒ‰ใฎใฟใ‚’ๅ‡บๅŠ›ใ—ใฆใใ ใ•ใ„ใ€‚"
)

Limitations

  • Max token length: 4096 (very complex models may be truncated)
  • Trained on GenCAD-Code dataset only (specific CadQuery patterns)
  • Japanese system prompt used during training

Citation

If you use this model, please cite the GenCAD-Code dataset:

@misc{gencad-code,
  title={GenCAD-Code Dataset},
  author={CADCODER},
  url={https://huggingface.co/datasets/CADCODER/GenCAD-Code}
}
Downloads last month
-
Safetensors
Model size
8B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Nextorage/InternVL2-8B-GenCAD-Code-v2

Finetuned
(17)
this model

Dataset used to train Nextorage/InternVL2-8B-GenCAD-Code-v2