CoolFace
Modelpublic

Sailesh3000/html-llama3-htmlgen

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
0likes4downloads
Model Card

๐Ÿฆ™ 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

python
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:

bibtex
@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:

bibtex
@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.