yennik16/text-to-stl-parts
Viewer โข Updated โข 2.18k โข 77
Stage 1 of a text-to-STL pipeline. It reads a plain-English description of a simple mechanical part and decides which of five part families it is: pipe_gasket, washer, bracket, rect_container, cyl_container. The predicted type then selects the schema the parameter extractor fills in.
A small bag-of-words neural classifier written in PyTorch, with all weights trained from random initialisation (nothing pretrained).
normalizer.py: fractions, number words and units become decimal inches),
lowercased, every number is replaced by a <num> token, request-framing words ("I want it to be", "make", "please"...) are removed,
and the remaining words plus adjacent word pairs are looked up in a 1,201-token vocabulary (tokens seen in at least 2 training texts).| Metric | Value |
|---|---|
| Validation accuracy (91 real rows) | 100.0% |
| Test accuracy (87 real rows, unseen sizes) | 100.0% |
| Casual stress prompts (60, unusual wording, never trained on) | 100.0% |
import sys
from huggingface_hub import snapshot_download
path = snapshot_download("yennik16/text-to-stl-part-classifier"); sys.path.insert(0, path)
from model import PartTypeClassifier
from normalizer import normalize_text
clf = PartTypeClassifier(path)
print(clf.predict(normalize_text('a box 6 by 4 by 3 inches with 1/8" walls'))) # ('rect_container', {...})
Training and evaluation: Text_to_STL_Pipeline.ipynb (CMU Project 1).