Instructions to use LimYeri/CodeMind-Llama3.1-8B-unsloth-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LimYeri/CodeMind-Llama3.1-8B-unsloth-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LimYeri/CodeMind-Llama3.1-8B-unsloth-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LimYeri/CodeMind-Llama3.1-8B-unsloth-merged") model = AutoModelForCausalLM.from_pretrained("LimYeri/CodeMind-Llama3.1-8B-unsloth-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LimYeri/CodeMind-Llama3.1-8B-unsloth-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LimYeri/CodeMind-Llama3.1-8B-unsloth-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LimYeri/CodeMind-Llama3.1-8B-unsloth-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LimYeri/CodeMind-Llama3.1-8B-unsloth-merged
- SGLang
How to use LimYeri/CodeMind-Llama3.1-8B-unsloth-merged 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 "LimYeri/CodeMind-Llama3.1-8B-unsloth-merged" \ --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": "LimYeri/CodeMind-Llama3.1-8B-unsloth-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "LimYeri/CodeMind-Llama3.1-8B-unsloth-merged" \ --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": "LimYeri/CodeMind-Llama3.1-8B-unsloth-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use LimYeri/CodeMind-Llama3.1-8B-unsloth-merged 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 LimYeri/CodeMind-Llama3.1-8B-unsloth-merged 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 LimYeri/CodeMind-Llama3.1-8B-unsloth-merged to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for LimYeri/CodeMind-Llama3.1-8B-unsloth-merged to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="LimYeri/CodeMind-Llama3.1-8B-unsloth-merged", max_seq_length=2048, ) - Docker Model Runner
How to use LimYeri/CodeMind-Llama3.1-8B-unsloth-merged with Docker Model Runner:
docker model run hf.co/LimYeri/CodeMind-Llama3.1-8B-unsloth-merged
CodeMind-Llama3.1-8B-unsloth
Codemind Project is a language model developed to assist in solving and learning coding test problems. This model is fine-tuned using posts written by LeetCode users as training data, aiming to provide answers specialized for coding tests.
Model Information
- Base Model:
meta-llama/Meta-Llama-3.1-8B-Instruct - Fine-Tuning: Fine-tuned using the unsloth library based on the
unsloth/Meta-Llama-3.1-8B-Instructmodel - Fine-Tuning Process: Conducted with reference to the Llama 3.1 Conversational_notebook
Dataset Used
- LeetCode Python Solutions Dataset: LeetCode_Python_Solutions_Data
How to Use the Model
This model is accessible through HuggingFace's model hub and can be integrated into applications using the API. It is designed to generate explanations, code snippets, or guides for coding problems or programming-related questions.
# 자세한 사항은 demo-Llama3.1.ipynb 확인
from unsloth import FastLanguageModel
from unsloth.chat_templates import get_chat_template
from IPython.display import display, Markdown
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "LimYeri/CodeMind-Llama3.1-8B-unsloth", # YOUR MODEL YOU USED FOR TRAINING
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
tokenizer = get_chat_template(
tokenizer,
chat_template = "llama-3.1",
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
messages = [
{"role": "system", "content": "You are a kind coding test teacher."},
{"role": "user", "content": "Enter your coding problem or question here."},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize = True,
add_generation_prompt = True, # Must add for generation
return_tensors = "pt",
).to("cuda")
outputs = model.generate(input_ids = inputs, max_new_tokens = 3000, use_cache = True,
temperature = 0.5, min_p = 0.3) # Feel free to adjust the temperature and min_p
text = (tokenizer.batch_decode(outputs))[0].split('assistant<|end_header_id|>\n\n')[1].strip()
display(Markdown(text))
LoRA Configuration
- r: 16
- lora_alpha: 16
- lora_dropout: 0
- bias: "none"
- use_gradient_checkpointing: "unsloth"
Training Settings
- Per Device Train Batch Size: 8
- Gradient Accumulation Steps: 2
- Warmup Steps: 200
- Number of Training Epochs: 5
- Learning Rate: 2e-4
- fp16: not
is_bfloat16_supported() - bf16:
is_bfloat16_supported() - Logging Steps: 20
- Optimizer: "adamw_8bit"
- Weight Decay: 0.01
- LR Scheduler Type: "linear"
Evaluation Results Open LLM Leaderboard
| Metric | Value |
|---|---|
| Average | 22.17 |
| IFEval | 64.9 |
| BBH | 24.19 |
| MATH Lvl 5 | 9.97 |
| GPQA | 1.9 |
| MUSR | 6.04 |
| MMLU-PRO | 26 |
Fine-Tuning Code
Detailed fine-tuning code and settings can be found in the CodeMind-Extended GitHub repository.
- Downloads last month
- 5