Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LunarAI - Fine-tuned DeepSeek Coder V2 Lite for Spigot Plugin Development
|
| 2 |
+
|
| 3 |
+
## Model Description
|
| 4 |
+
|
| 5 |
+
**LunarAI** is a custom language model fine-tuned from the `deepseek-ai/DeepSeek-Coder-V2-Lite-Base` model. It has been specialized to act as an AI programming assistant, with a particular focus on **Spigot/Minecraft plugin development**.
|
| 6 |
+
|
| 7 |
+
This model is designed to provide accurate code examples, explanations, and guidance related to the Spigot API and general Java programming concepts relevant to creating Minecraft server plugins.
|
| 8 |
+
|
| 9 |
+
## Training Details
|
| 10 |
+
|
| 11 |
+
* **Base Model:** `deepseek-ai/DeepSeek-Coder-V2-Lite-Base`
|
| 12 |
+
* **Fine-tuning Method:** LoRA (Low-Rank Adaptation)
|
| 13 |
+
* **Dataset:** A custom dataset (`spigot_dataset.jsonl`) focused on Spigot/Minecraft plugin development, including common tasks, event handling, and API usage.
|
| 14 |
+
* **Adapter Size:** Approximately 1.1 GB (LoRA adapter before merge)
|
| 15 |
+
* **Training Framework:** Axolotl
|
| 16 |
+
|
| 17 |
+
## Model Files
|
| 18 |
+
|
| 19 |
+
This repository contains two main versions of the fine-tuned model:
|
| 20 |
+
|
| 21 |
+
1. **Full Merged Model (Safetensors):** The complete model with the LoRA adapter merged into the base model's weights. This is the standard Hugging Face format, ideal for further development or use with `transformers`.
|
| 22 |
+
* Files: `model-00001-of-00007.safetensors` through `model-00007-of-00007.safetensors` (totaling ~31.4 GB)
|
| 23 |
+
* Configuration files: `config.json`, `tokenizer.json`, `special_tokens_map.json`, etc.
|
| 24 |
+
|
| 25 |
+
2. **Quantized GGUF Model (for Ollama):** A highly optimized, quantized version of the merged model in GGUF format, specifically designed for efficient local inference with tools like Ollama.
|
| 26 |
+
* File: `model.gguf` (~16.7 GB, `q8_0` quantization)
|
| 27 |
+
|
| 28 |
+
## How to Use LunarAI with Ollama (Recommended for Local Inference)
|
| 29 |
+
|
| 30 |
+
To run **LunarAI** locally using Ollama, follow these steps:
|
| 31 |
+
|
| 32 |
+
1. **Ensure Ollama is Installed:** If you don't have Ollama, install it from [ollama.com](https://ollama.com/).
|
| 33 |
+
2. **Download `model.gguf`:** You can download the `model.gguf` file directly from this repository's "Files" tab, or use `ollama pull ThePegasusGroup/LunarAI` if Ollama supports direct pulling of GGUF files from the Hub (this might require a `Modelfile` first).
|
| 34 |
+
3. **Create a `Modelfile`:** In the same directory as your downloaded `model.gguf`, create a file named `Modelfile` with the following content:
|
| 35 |
+
|
| 36 |
+
```dockerfile
|
| 37 |
+
# Tell Ollama which GGUF file to use
|
| 38 |
+
FROM ./model.gguf
|
| 39 |
+
|
| 40 |
+
# Set the chat template for DeepSeek Coder
|
| 41 |
+
TEMPLATE """{% for message in messages %}{% if message['role'] == 'user' %}{{ 'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company. Follow the user\'s instructions carefully. Respond using markdown.' }}\n### Instruction:\n{{ message['content'] }}\n### Response:\n{% elif message['role'] == 'assistant' %}{{ message['content'] }}{% if not loop.last %}\n{% endif %}{% endif %}{% endfor %}"""
|
| 42 |
+
|
| 43 |
+
# Set a default parameter
|
| 44 |
+
PARAMETER temperature 0.7
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
4. **Create the Model in Ollama:**
|
| 48 |
+
```bash
|
| 49 |
+
ollama create LunarAI -f ./Modelfile
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
5. **Run LunarAI:**
|
| 53 |
+
```bash
|
| 54 |
+
ollama run LunarAI
|
| 55 |
+
```
|
| 56 |
+
You can then start asking it questions related to Spigot plugin development!
|
| 57 |
+
|
| 58 |
+
## How to Load the Merged Model with Hugging Face Transformers
|
| 59 |
+
|
| 60 |
+
If you wish to load the full, unquantized merged model for further development or advanced usage with the `transformers` library:
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 64 |
+
import torch
|
| 65 |
+
|
| 66 |
+
# Replace 'ThePegasusGroup/LunarAI' with the actual repo ID if you renamed it
|
| 67 |
+
model_id = "ThePegasusGroup/LunarAI"
|
| 68 |
+
|
| 69 |
+
# Load the model
|
| 70 |
+
# Ensure you have sufficient VRAM (GPU memory) or RAM for this large model
|
| 71 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 72 |
+
model_id,
|
| 73 |
+
torch_dtype=torch.bfloat16, # Or torch.float16, or torch.float32 depending on your hardware
|
| 74 |
+
device_map="auto",
|
| 75 |
+
trust_remote_code=True # Required for DeepSeek-Coder-V2-Lite-Base architecture
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
# Load the tokenizer
|
| 79 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 80 |
+
|
| 81 |
+
print("LunarAI model loaded successfully!")
|