Sailesh3000/html-llama3-htmlgen
๐ฆ Llama3-HTMLGen-Unsloth โ Fine-tuned HTML Code Generation Model
This model is a fine-tuned version of unsloth/llama-3.2-3b-instruct-bnb-4bit, optimized for HTML code generation from natural language prompts. It has been fine-tuned using Supervised Fine-Tuning (SFT) with the Unsloth and TRL frameworks.
๐ Model Overview
- Base Model: Llama 3.2 3B Instruct (4-bit quantized)
- Fine-tuning Type: LoRA + SFT
- Objective: Convert natural language prompts into valid and well-structured HTML code
- Libraries Used: PEFT, TRL, Transformers, PyTorch
This model enables developers and learners to quickly generate HTML snippets for educational, prototyping, or code-assistive use cases.
๐ง Use Cases
- Rapid HTML prototyping
- Educational tools for HTML learners
- Natural language โ Code assistants
- Automated UI code generation
๐ก Example Usage
from transformers import pipeline
generator = pipeline("text-generation", model="username/llama3-htmlgen-unsloth", device="cuda")
prompt = "Generate HTML code for a webpage with a header saying 'Welcome to My Portfolio' and a blue background."
output = generator(prompt, max_new_tokens=200, return_full_text=False)[0]
print(output["generated_text"])โ๏ธ Training Details
Training Approach: Supervised Fine-Tuning (SFT) using LoRA adapters Base Model: unsloth/llama-3.2-3b-instruct-bnb-4bit Batch Size: 8 Optimizer: AdamW Learning Rate: 2e-4 Epochs: 3 Precision: 4-bit quantization
Framework Versions
- PEFT: 0.17.1
- TRL: 0.23.0
- Transformers: 4.57.1
- PyTorch: 2.8.0+cu126
- Datasets: 4.3.0
- Tokenizers: 0.22.1
๐ Evaluation Metrics
The model was evaluated qualitatively on prompt-to-HTML consistency, structure correctness, and tag balance. Early experiments show strong capability in generating valid and readable HTML structures.
๐ Citation
If you use this model in your research or project, please cite:
@misc{llama3htmlgen2025,
title = {Llama3-HTMLGen-Unsloth: Fine-tuned Llama 3.2 for HTML Code Generation},
author = {Your Name},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/username/llama3-htmlgen-unsloth}}
}And TRL:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and others},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}๐งพ License
This model is released under the Apache 2.0 License. You are free to use, modify, and distribute it with attribution.
