← 开源
minosvasilias

godot-dodo

Finetuning large language models for GDScript generation.

Model DevelopmentFine-tuningPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
577
Star
28
Fork
+0
本周
1
贡献者
创建于 2023-04-23 · 更新于 2026-10-13 · 今日第 16698 名
主要开发者
minosvasilias

minosvasilias/godot-dodo 排名第 16,698,有 577 个星标。

同类别比较

minosvasilias/godot-dodo 排名第 16,698,此处有 8 个同类条目;salesforce/CodeRL 排名第 16,700。

同类别比较
名称排名指标
benmoseley/FBPINNs16,690
语言:
Python
星标数:
577
分叉数:
117
简介:
Solve forward and inverse problems related to partial differential equations using finite basis physics-informed neural networks (FBPINNs)
facebookresearch/vicreg16,692
语言:
Python
星标数:
577
分叉数:
92
简介:
VICReg official code base
floodsung/DDPG16,693
语言:
Python
星标数:
577
分叉数:
177
简介:
Reimplementation of DDPG(Continuous Control with Deep Reinforcement Learning) based on OpenAI Gym + Tensorflow
huggingface/cosmopedia16,694
语言:
Python
星标数:
577
分叉数:
49
salesforce/CodeRL16,700
语言:
Python
星标数:
577
分叉数:
69
简介:
This is the official code for the paper CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning (NeurIPS22).
xuhongzuo/DeepOD16,703
语言:
Python
星标数:
577
分叉数:
70
简介:
Deep learning-based outlier/anomaly detection
Confusezius/Deep-Metric-Learning-Baselines16,705
语言:
Python
星标数:
576
分叉数:
92
简介:
PyTorch Implementation for Deep Metric Learning Pipelines
MilesCranmer/lagrangian_nns16,707
语言:
Python
星标数:
576
分叉数:
111
简介:
Lagrangian Neural Networks
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Fine-tuning
关键词Coding, Text-to-code
星标数577
分叉数28
贡献者1
创建日期2023-04-23
更新日期2026-10-13
1 天星标数0
7 天星标数0
排名16,698
上次排名16,485
排名变化-213
7 天星标排名15,672
上次 7 天星标排名15,677
7 天星标排名变化5
总星标排名17,310
上次总星标排名17,280
总星标排名变化-30
国家Germany
README 摘录

godot-dodo The godot-dodo project presents a pipeline to finetune open source language models on human-created, language-specific code retrieved from GitHub. In this case, the targeted language is GDScript, but the same methodology can be applied to other languages. This repository includes the following: Scripts to assemble the finetuning dataset Pre-assembled, raw datasets (up to a size of 60k rows) Scripts to finetune a model Links to model weights Performance report comparing finetuned models Performance **For

comprehensive results explaining the methodology used and a full list of all result, please refer to the full performance report here. ** In summary, models achieve significantly greater consistency than / when it comes to generating accurate GDScript syntax, and variants trained on code-specific base-models can even outperform them on complex instructions. The major remaining weakpoint of this approach is the loss in appropriate verbosity when writing methods. Since human-written samples will often include references to objects initialized outside

of the scope of the sample method, the model learns to do the same, resulting in cases where functionality relevant to the instruction is assumed to be already implemented. This can most likely be improved significantly by a more sophisticated dataset. Unlike other, similar approaches to finetuning models such as stanford-alpaca, this approach does not use existing, larger language models for the output-values of the finetuning-dataset. Language models are instead only used to **label** each code snippet

. As such, we can assemble data-pairs in the style of CodeSearchNet, making use of powerful existing models to annotate high-quality human-created code. Some existing language models such as are excellent coders. However, a lot of their ability is concentrated in only the most popular languages, such as Python or Javascript. Less widely used languages are underrepresented in the training data and experience a massive performance drop-off, where models routinely mistake syntax or hallucinate language features that

do not exist. This aims to provide much more robust language-specific models that can be used to reliably generate code that compiles on first try. Demo To try out the pre-trained models, you can use the inference_demo. In order to use that notebook on Google Colab, follow this link. Dataset Generation Due to this approach relying on human-created data, we scrape GitHub repositories using the GitHub search API. Using the search term, we retrieve a list

of repositories including GDScript code. We also use to limit the dataset to suitable repositories. **Only MIT-licensed code is used for training! ** We then clone each one and apply the following logic: Find file Detect whether project is made for or Godot engine versions Iterate through all files found in the repository For each one, split file into individual functions For each function found, ask existing LLM ( ) for a detailed comment describing the functions purpose Add data pair to

dataset Note that existing, human-written comments located above the code-block are not used for the value. We are

常见问题

记录了多少星标和分叉?

minosvasilias/godot-dodo 有 577 个星标和 28 个分叉。

仓库排名是多少?

minosvasilias/godot-dodo 排名第 16,698。

记录的语言和类别是什么?

minosvasilias/godot-dodo 有 577 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

minosvasilias/godot-dodo 与 salesforce/CodeRL 比较,后者排名第 16,700,有 577 个星标。

README

godot-dodo

The godot-dodo project presents a pipeline to finetune open source language models on human-created, language-specific code retrieved from GitHub.

In this case, the targeted language is GDScript, but the same methodology can be applied to other languages.

This repository includes the following:

  • Scripts to assemble the finetuning dataset
  • Pre-assembled, raw datasets (up to a size of 60k rows)
  • Scripts to finetune a model
  • Links to model weights
  • Performance report comparing finetuned models

Performance

For comprehensive results explaining the methodology used and a full list of all result, please refer to the full performance report here.

In summary, godot_dodo models achieve significantly greater consistency than gpt-4/gpt-3.5-turbo when it comes to generating accurate GDScript syntax, and variants trained on code-specific base-models can even outperform them on complex instructions.

The major remaining weakpoint of this approach is the loss in appropriate verbosity when writing methods. Since human-written samples will often include references to objects initialized outside of the scope of the sample method, the model learns to do the same, resulting in cases where functionality relevant to the instruction is assumed to be already implemented. This can most likely be improved significantly by a more sophisticated dataset.

Concept

How?

Unlike other, similar approaches to finetuning models such as stanford-alpaca, this approach does not use existing, larger language models for the output-values of the finetuning-dataset. All code used is human-created. Language models are instead only used to label each code snippet.

As such, we can assemble comment:code data-pairs in the style of CodeSearchNet, making use of powerful existing models to annotate high-quality human-created code.

Why?

Some existing language models such as gpt-4 are excellent coders. However, a lot of their ability is concentrated in only the most popular languages, such as Python or Javascript.

Less widely used languages are underrepresented in the training data and experience a massive performance drop-off, where models routinely mistake syntax or hallucinate language features that do not exist.

This aims to provide much more robust language-specific models that can be used to reliably generate code that compiles on first try.

Demo

To try out the pre-trained models, you can use the inference_demo.ipynb notebook.

In order to use that notebook on Google Colab, follow this link.

Dataset Generation

Due to this approach relying on human-created data, we scrape GitHub repositories using the GitHub search API.

Using the language:gdscript search term, we retrieve a list of repositories including GDScript code.

We also use license:mit to limit the dataset to suitable repositories. Only MIT-licensed code is used for training!

We then clone each one and apply the following logic:

  • Find project.godot file
  • Detect whether project is made for 3.x or 4.x Godot engine versions
  • Iterate through all .gd files found in the repository
  • For each one, split file into individual functions
  • For each function found, ask existing LLM (gpt-3.5-turbo) for a detailed comment describing the functions purpose
  • Add instruction:response data pair to dataset

Note that existing, human-written comments located above the code-block are not used for the instruction value. We are interested in consistent detail for comments, rather than trying to preserve some potentially higher-quality human-written ones.

Human comments within the code block however are preserved.

Run

To assemble a dataset yourself, follow these instructions:

  • Run python data/generate_unlabeled_dataset.py
  • Run python data/label_dataset.py

Please do note that you'll need GitHub and OpenAI API keys in order to use these scripts.

Pre-assembled datasets

Pre-assembled datasets included in this repository:

Further datasets may be added in the future (particularly regarding 3.x data)

Finetuning

The fine-tuning process closely mirrors the one introduced by stanford_alpaca.

To reproduce a fine-tuned version of LLaMA, please follow the steps below.

Hardware Requirements

In order to effectively finetune a llama-7b or llama-13b model, it is highly recommended to use at least two A100 80GB GPUs. You may otherwise encounter out of memory errors or experience extremely long training times, and will need to adjust the training parameters.

For finetuning godot_dodo_4x_60k_llama_13b, eight A100 80GB GPUs were used.

Another important consideration is the protocol used for GPU communication. It is recommended to use NVLink setups rather than PCIe.

Should you only have access to PCIe setups, please replace full-shard with shard_grad_op in the torchrun command. This may severely speed up your training runs at the cost of potentially higher memory usage.

Setup

Before finetuning, make sure to install all requirements using:

pip install -r requirements.txt

Run

For exact commands used for finetuning models, please refer to the individual model pages:

Inference

To test out your finetuned model, you can use the eval.py script. Simply run:

python finetune/eval.py --model_name_or_path PATH_TO_FINETUNED_MODEL/

Publishing to Huggingface

To easily upload a finetuned model to Huggingface, you can use:

python finetune/push_to_hub.py --model_name_or_path PATH_TO_FINETUNED_MODEL/ --push_name HF_MODEL_NAME --auth_token HF_ACCESS_TOKEN

Finetuned model weights

Links to model weights hosted on Huggingface are provided in the respective model pages:

Cost

Below the dollar-cost of assembling each available dataset and finetuning each model.

Datasets

Finetuned Models

Use with godot-copilot

Usage of finetuned models with godot-copilot for in-editor, fully local code generation may be supported in the future.

Acknowledegments

Thank you to all MIT-licensed Godot projects! This would not be possible without you.

All projects that were scraped during assembly of the included finetuning data are listed in the respective dataset folders in data.

Another thank you goes to fluidstack.io for their reliable, cheap GPU instances that were used for finetuning these models.

Citation

If you wish to cite this project, please use:

@misc{godot-dodo,
  author = {Markus Sobkowski},
  title = {Godot-Dodo: Finetuned language models for GDScript generation},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/minosvasilias/godot-dodo}},
}

You should also cite the original LLaMA paper as well as stanford-alpaca.

排名相邻
同类项目