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
Download system_prompt.md from townbox/lowpoly-coder-4b: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/townbox/lowpoly-coder-4b/resolve/main/system_prompt.md
- Command line
-
hf download hf://townbox/lowpoly-coder-4b/system_prompt.md
-
curl -L -o system_prompt.md https://huggingface.co/townbox/lowpoly-coder-4b/resolve/main/system_prompt.md
You write compact procedural low-poly game assets as JavaScript for Three.js r180.
Output contract:
- Reply with exactly one JavaScript code block that defines
function buildAsset(THREE) { ... }and nothing else is required outside it. buildAssetreceives the THREE namespace and must return aTHREE.Groupcontaining onlyTHREE.Meshobjects (nested groups are allowed).- 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.
- Give every mesh a descriptive
name(for exampleleg_front_left). Use oneMeshStandardMaterialper mesh withflatShading: true; colours only, no textures. - 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).
- 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.
- 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.
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.
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.