--- language: - en license: llama3.1 license_name: llama3.1 license_link: https://huggingface.co/meta-llama/Llama-3.1-8B/blob/main/LICENSE base_model: meta-llama/Llama-3.1-8B tags: - llama - llama-3.1 - unsloth - lora - code-generation - python - gguf datasets: - flytech/python-codes-25k pipeline_tag: text-generation library_name: transformers --- # Python-wizard-Llama-3.1-8b A Python code-generation assistant fine-tuned from **Meta-Llama-3.1-8B** using LoRA, trained with [Unsloth](https://github.com/unslothai/unsloth), and exported to GGUF for local inference (Ollama / llama.cpp). Built with Llama. ## Model Details - **Base model:** [meta-llama/Llama-3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) - **Fine-tuning method:** LoRA (Low-Rank Adaptation), via Unsloth - **Quantized base:** `unsloth/Meta-Llama-3.1-8B-bnb-4bit` (4-bit) used during training - **Task:** Instruction-following Python code generation - **Export format:** GGUF, quantized `Q4_K_M` (~4.92 GB) - **Language:** English ## Training Data Fine-tuned on [`flytech/python-codes-25k`](https://huggingface.co/datasets/flytech/python-codes-25k), a dataset of instruction/input/output triples for Python code generation tasks. Prompt format used during training: ``` Below is an instruction that describes a task, paired with an optional introductory context. Write a response that appropriately completes the request with clean Python code. ### Instruction: {instruction} ### Context: {input} ### Response: {output} ``` ## Training Configuration | Parameter | Value | |---|---| | LoRA rank (r) | 16 | | LoRA alpha | 16 | | LoRA dropout | 0 | | Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj | | Bias | none | | Max sequence length | 2048 | | Quantization (training) | 4-bit | | Gradient checkpointing | Unsloth (optimized) | | Random seed | 3407 | > Note: this checkpoint was trained for a limited number of steps (checkpoint-60). Treat outputs as a proof-of-concept rather than a fully converged model — see Limitations below. ## Usage ### With Ollama ```bash ollama run hf.co/ShyamSaran-18/Python-wizard-Llama-3.1-8b ``` ### With llama.cpp ```bash llama-cli -hf ShyamSaran-18/Python-wizard-Llama-3.1-8b --jinja ``` ### With transformers + PEFT (LoRA adapter, if published separately) ```python from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B") tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B") model = PeftModel.from_pretrained(base, "ShyamSaran-18/Python-wizard-Llama-3.1-8b") ``` ## Intended Use Generating Python code snippets and completions from natural-language instructions. Intended for experimentation, learning, and portfolio demonstration of LoRA fine-tuning and local LLM deployment workflows. ## Limitations - Trained on a single open dataset with a limited number of training steps; not benchmarked against held-out evaluation data. - Inherits the general limitations and biases of the base Llama 3.1 model. - Generated code should be reviewed before use — no guarantees of correctness, security, or production-readiness. - Not evaluated for languages other than Python or for tasks outside code generation. ## License This model is a fine-tuned derivative of Meta's Llama 3.1 and is distributed under the **Llama 3.1 Community License**. - License text: https://huggingface.co/meta-llama/Llama-3.1-8B/blob/main/LICENSE - Acceptable Use Policy: https://llama.meta.com/llama3_1/use-policy By using this model you agree to the terms of the Llama 3.1 Community License Agreement. Use of this model must also comply with Meta's Acceptable Use Policy. **Notice:** Llama 3.1 is licensed under the Llama 3.1 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved. ## Acknowledgements - [Meta AI](https://ai.meta.com/llama/) for the base Llama 3.1 model - [Unsloth](https://github.com/unslothai/unsloth) for efficient fine-tuning and GGUF export tooling - [flytech/python-codes-25k](https://huggingface.co/datasets/flytech/python-codes-25k) dataset authors