Instructions to use cartmoney/CartCode-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cartmoney/CartCode-1 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/tmp/model_download") model = PeftModel.from_pretrained(base_model, "cartmoney/CartCode-1") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
|
Download README.md from cartmoney/CartCode-1: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/cartmoney/CartCode-1/resolve/main/README.md
- Command line
-
hf download hf://cartmoney/CartCode-1/README.md
-
curl -L -o README.md https://huggingface.co/cartmoney/CartCode-1/resolve/main/README.md
1.5 kB
| license: apache-2.0 | |
| tags: | |
| - code | |
| - qwen2.5 | |
| - unsloth | |
| - lora | |
| base_model: Qwen/Qwen2.5-3B-Instruct | |
| library_name: peft | |
| # CartCode-1 (LoRA Adapter) | |
| This is a LoRA adapter for **Qwen 2.5 3B Instruct**, fine-tuned for code generation. | |
| ## 🔧 Training Details | |
| - **Base Model**: Qwen/Qwen2.5-3B-Instruct | |
| - **Method**: Unsloth + LoRA | |
| - **Phase 1**: SFT on custom code dataset | |
| - **Phase 2**: DPO on jondurbin/py-dpo-v0.1 | |
| ## 🚀 Usage | |
| You can use this model with Unsloth or PEFT. | |
| ### With Unsloth (Recommended) | |
| ```python | |
| from unsloth import FastLanguageModel | |
| model, tokenizer = FastLanguageModel.from_pretrained( | |
| model_name = "cartmoney/CartCode-1", | |
| max_seq_length = 2048, | |
| load_in_4bit = True, | |
| ) | |
| FastLanguageModel.for_inference(model) | |
| # Use with system prompt | |
| messages = [ | |
| {"role": "system", "content": "You are an expert Python programmer."}, | |
| {"role": "user", "content": "Write a function to calculate factorial"} | |
| ] | |
| inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to("cuda") | |
| outputs = model.generate(inputs, max_new_tokens=256) | |
| print(tokenizer.decode(outputs[0])) | |
| ``` | |
| ### With PEFT/Transformers | |
| ```python | |
| from peft import PeftModel, PeftConfig | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| config = PeftConfig.from_pretrained("cartmoney/CartCode-1") | |
| base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-3B-Instruct") | |
| model = PeftModel.from_pretrained(base_model, "cartmoney/CartCode-1") | |
| ``` | |