unity-coder-7b / README.md
vishnuOI's picture
Upload README.md with huggingface_hub
982a907 verified
metadata
license: cc-by-4.0
language:
  - en
tags:
  - unity
  - unity3d
  - game-development
  - csharp
  - xr
  - vr
  - ar
  - openxr
  - code
  - finetuned
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
datasets:
  - vishnuOI/unity-dev-instructions

Unity Coder 7B

A fine-tuned version of Qwen2.5-Coder-7B-Instruct specialized for Unity game development in C#.

Training

  • Base model: Qwen/Qwen2.5-Coder-7B-Instruct
  • Method: QLoRA (4-bit NF4, r=16, alpha=32)
  • Dataset: vishnuOI/unity-dev-instructions
  • Training pairs: 1,687 Unity C# instruction pairs
  • Epochs: 3

Capabilities

  • Unity C# scripting (MonoBehaviour, ScriptableObjects, coroutines)
  • XR/VR development (OpenXR, XR Interaction Toolkit)
  • Physics, animation, UI Toolkit
  • Editor scripting and tooling
  • Performance optimization patterns

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "vishnuOI/unity-coder-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

messages = [
    {"role": "system", "content": "You are an expert Unity game developer specializing in C# scripting and XR development."},
    {"role": "user", "content": "How do I detect collision between two objects in Unity?"},
]

text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))