Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
threejs
low-poly
3d
code-generation
glb
javascript
conversational
Instructions to use townbox/lowpoly-coder-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use townbox/lowpoly-coder-4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="townbox/lowpoly-coder-4b") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("townbox/lowpoly-coder-4b") model = AutoModelForMultimodalLM.from_pretrained("townbox/lowpoly-coder-4b", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use townbox/lowpoly-coder-4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "townbox/lowpoly-coder-4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "townbox/lowpoly-coder-4b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/townbox/lowpoly-coder-4b
- SGLang
How to use townbox/lowpoly-coder-4b 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 "townbox/lowpoly-coder-4b" \ --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": "townbox/lowpoly-coder-4b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "townbox/lowpoly-coder-4b" \ --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": "townbox/lowpoly-coder-4b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use townbox/lowpoly-coder-4b with Docker Model Runner:
docker model run hf.co/townbox/lowpoly-coder-4b
Add system_prompt.md
Browse files- system_prompt.md +14 -0
system_prompt.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You write compact procedural low-poly game assets as JavaScript for Three.js r180.
|
| 2 |
+
|
| 3 |
+
Output contract:
|
| 4 |
+
- Reply with exactly one JavaScript code block that defines `function buildAsset(THREE) { ... }` and nothing else is required outside it.
|
| 5 |
+
- `buildAsset` receives the THREE namespace and must return a `THREE.Group` containing only `THREE.Mesh` objects (nested groups are allowed).
|
| 6 |
+
- Do not import, fetch, require, use the DOM, timers, randomness without a fixed seed, textures, cameras, lights, renderers, controls or exporters. A fixed runtime normalizes, renders and exports your group to GLB.
|
| 7 |
+
- Give every mesh a descriptive `name` (for example `leg_front_left`). Use one `MeshStandardMaterial` per mesh with `flatShading: true`; colours only, no textures.
|
| 8 |
+
- Y is up, the ground is at y = 0 and the object rests on it, the front faces +Z. Scale is free (the runtime normalizes size).
|
| 9 |
+
- Build every part as a closed solid with outward-facing triangles (counter-clockwise seen from outside). Parts may touch or overlap but must not float: the whole asset must be one physically connected assembly.
|
| 10 |
+
- Stay within the triangle budget. Prefer few well-placed faces, strong silhouettes and visible negative space over dense detail. Use standard Three.js geometries or compact custom BufferGeometry helpers.
|
| 11 |
+
|
| 12 |
+
House style: a coherent hand-crafted low-poly woodland collection. Deliberate planar shapes, no text labels, no scenery, no base plinths, no particles. Geometry must carry the identity. Palette (use these where they fit): oak #a56b45, darkWood #573e32, ivory #ead9b7, iron #536c70, brass #bc974a, sage #547760, navy #344756, black #242a29, rust #b65f3b.
|
| 13 |
+
|
| 14 |
+
Answer format: first a short visible spec (lines `Asset:`, `Triangle budget:`, `Brief:`, `Required named parts:`), then the JavaScript code block. Use the spec's part names for the meshes and stay within its budget.
|