Text Generation
PEFT
Safetensors
English
godot
godot4
gdscript
game-development
lora
qlora
unsloth
code
saltshakerstudio
conversational
Instructions to use SaltShakerStudio/Qwen2.5-GodotCoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SaltShakerStudio/Qwen2.5-GodotCoder with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen2.5-coder-7b-instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "SaltShakerStudio/Qwen2.5-GodotCoder") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use SaltShakerStudio/Qwen2.5-GodotCoder with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SaltShakerStudio/Qwen2.5-GodotCoder to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SaltShakerStudio/Qwen2.5-GodotCoder to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for SaltShakerStudio/Qwen2.5-GodotCoder to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="SaltShakerStudio/Qwen2.5-GodotCoder", max_seq_length=2048, )
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,22 +1,101 @@
|
|
| 1 |
---
|
| 2 |
-
base_model: unsloth/qwen2.5-coder-7b-instruct-bnb-4bit
|
| 3 |
-
tags:
|
| 4 |
-
- text-generation-inference
|
| 5 |
-
- transformers
|
| 6 |
-
- unsloth
|
| 7 |
-
- qwen2
|
| 8 |
-
- trl
|
| 9 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
language:
|
| 11 |
-
- en
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
-
|
| 17 |
-
- **License:** apache-2.0
|
| 18 |
-
- **Finetuned from model :** unsloth/qwen2.5-coder-7b-instruct-bnb-4bit
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
+
base_model: unsloth/Qwen2.5-Coder-7B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- godot
|
| 6 |
+
- godot4
|
| 7 |
+
- gdscript
|
| 8 |
+
- game-development
|
| 9 |
+
- lora
|
| 10 |
+
- qlora
|
| 11 |
+
- unsloth
|
| 12 |
+
- code
|
| 13 |
+
- saltshakerstudio
|
| 14 |
+
datasets:
|
| 15 |
+
- glaiveai/godot_4_docs
|
| 16 |
language:
|
| 17 |
+
- en
|
| 18 |
+
library_name: peft
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# Qwen2.5-Coder-7B-Instruct β Godot 4 / GDScript LoRA
|
| 23 |
+
|
| 24 |
+
A LoRA adapter for [unsloth/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/unsloth/Qwen2.5-Coder-7B-Instruct), fine-tuned on Godot 4 documentation Q&A to improve knowledge of modern Godot 4 GDScript syntax and APIs.
|
| 25 |
+
|
| 26 |
+
**Motivation:** Most open GDScript fine-tunes (e.g. godot-dodo, 2023) were trained on Godot 3 code and produce outdated syntax. Even current code models frequently mix Godot 3 and Godot 4 patterns. This adapter is a first attempt at nudging a modern 7B coder model toward Godot 4 conventions, trained locally on a single consumer GPU.
|
| 27 |
+
|
| 28 |
+
## Training details
|
| 29 |
+
|
| 30 |
+
| | |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Base model | unsloth/Qwen2.5-Coder-7B-Instruct |
|
| 33 |
+
| Method | QLoRA (4-bit), via Unsloth Fine-tuning Studio |
|
| 34 |
+
| Dataset | [glaiveai/godot_4_docs](https://huggingface.co/datasets/glaiveai/godot_4_docs) (~3,490 Q&A pairs generated from Godot 4 documentation) |
|
| 35 |
+
| Epochs | 2 |
|
| 36 |
+
| Learning rate | 2e-4, linear schedule |
|
| 37 |
+
| LoRA rank / alpha / dropout | 16 / 16 / 0 |
|
| 38 |
+
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
|
| 39 |
+
| Batch size | 2 (gradient accumulation 4, effective 8) |
|
| 40 |
+
| Optimizer | AdamW 8-bit, weight decay 0.001 |
|
| 41 |
+
| Max sequence length | 4096 |
|
| 42 |
+
| Hardware | Single RTX 4080 (16 GB), Windows 11 |
|
| 43 |
+
| Training time | ~45 minutes |
|
| 44 |
+
|
| 45 |
+
Eval loss fell from ~0.83 to ~0.775 and plateaued. Runs at 1, 2, and 3 epochs showed 2 epochs to be the sweet spot for this dataset: 1 epoch left eval loss still declining, 3 epochs overfit (eval loss climbed after epoch 2 and chat-test quality regressed).
|
| 46 |
+
|
| 47 |
+
## What it improves
|
| 48 |
+
|
| 49 |
+
Compared to the base model in side-by-side chat tests, the adapter more consistently produces some Godot 4 conventions, for example the `@export` annotation:
|
| 50 |
+
|
| 51 |
+
```gdscript
|
| 52 |
+
@export var speed: int = 300 # Godot 4 β
|
| 53 |
+
# instead of:
|
| 54 |
+
export var speed = 300 # Godot 3 β
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
Responses also tend to be more concise and code-focused, reflecting the Q&A style of the training data.
|
| 58 |
+
|
| 59 |
+
## Known limitations β read before using
|
| 60 |
+
|
| 61 |
+
**This adapter does not fully solve the Godot 3 β 4 problem.** In testing, both the base model and this fine-tune still frequently produce Godot 3 patterns, especially:
|
| 62 |
+
|
| 63 |
+
- **Signal connections** β often writes the old form `button.connect("pressed", self, "_on_pressed")` instead of the Godot 4 form `button.pressed.connect(_on_pressed)`
|
| 64 |
+
- **Character movement** β may use `Sprite2D` or `KinematicBody2D` instead of `CharacterBody2D`, and `move_and_slide(velocity)` instead of `move_and_slide()`
|
| 65 |
+
|
| 66 |
+
The training dataset is derived from Godot 4 documentation and appears to be thin on these common game-programming patterns, so the model had little opportunity to learn them. Treat generated code as a draft and verify against the [current Godot documentation](https://docs.godotengine.org/en/stable/).
|
| 67 |
+
|
| 68 |
+
Other caveats:
|
| 69 |
+
|
| 70 |
+
- Trained and tested in English only
|
| 71 |
+
- Not evaluated on Godot C#, shaders (GDShader), or Godot 3 back-compatibility questions
|
| 72 |
+
- No safety or alignment tuning beyond what the base model provides
|
| 73 |
+
|
| 74 |
+
## Usage
|
| 75 |
+
|
| 76 |
+
Load the adapter on top of the base model with PEFT:
|
| 77 |
+
|
| 78 |
+
```python
|
| 79 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 80 |
+
from peft import PeftModel
|
| 81 |
+
|
| 82 |
+
base = AutoModelForCausalLM.from_pretrained(
|
| 83 |
+
"unsloth/Qwen2.5-Coder-7B-Instruct",
|
| 84 |
+
load_in_4bit=True,
|
| 85 |
+
device_map="auto",
|
| 86 |
+
)
|
| 87 |
+
tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen2.5-Coder-7B-Instruct")
|
| 88 |
+
model = PeftModel.from_pretrained(base, "YOUR_USERNAME/YOUR_REPO_NAME")
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Or merge and export to GGUF for local runners (llama.cpp, Ollama, LM Studio) β Unsloth Fine-tuning Studio provides an Export to GGUF option.
|
| 92 |
+
|
| 93 |
+
## Intended use
|
| 94 |
|
| 95 |
+
Hobbyist / experimental. A starting point for anyone interested in local Godot 4 coding assistants β including eventual use alongside a Godot MCP server, where better Godot 4 knowledge should translate into more correct tool calls. Contributions of better Godot 4 training data (especially signals, movement, and node-setup examples) would likely help more than additional training epochs on the current dataset.
|
|
|
|
|
|
|
| 96 |
|
| 97 |
+
## Acknowledgements
|
| 98 |
|
| 99 |
+
- Base model: Qwen team / Unsloth quantization
|
| 100 |
+
- Dataset: Glaive AI's godot_4_docs
|
| 101 |
+
- Training: Unsloth Fine-tuning Studio
|