How to use from
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 "KavinduHansaka/Llama-3.2-3B-ImageGen" \
    --host 0.0.0.0 \
    --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "KavinduHansaka/Llama-3.2-3B-ImageGen",
		"prompt": "Once upon a time,",
		"max_tokens": 512,
		"temperature": 0.5
	}'
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 "KavinduHansaka/Llama-3.2-3B-ImageGen" \
        --host 0.0.0.0 \
        --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "KavinduHansaka/Llama-3.2-3B-ImageGen",
		"prompt": "Once upon a time,",
		"max_tokens": 512,
		"temperature": 0.5
	}'
Quick Links

Llama-3.2-3B — Image Prompt Generation (LoRA Merged)

This repository provides a LoRA-finetuned & merged version of meta-llama/Llama-3.2-3B, specialized for image prompt generation.
It is designed to create cinematic, detailed, and structured prompts for text-to-image models such as Stable Diffusion XL and Flux.

Note: This is a prompt-generation model, not an instruction/chat model. It is trained to produce concise, creative prompts suitable for diffusion-based image synthesis.


Model Details

Model Sources


What’s Included

  • config.json, generation_config.json
  • Merged model weights (model.safetensors)
  • Tokenizer files (tokenizer.json, tokenizer_config.json, special_tokens_map.json)

Uses

Direct Use

  • Generate stylized, cinematic, or structured prompts for image synthesis models (Stable Diffusion, Flux, SDXL).

Downstream Use

  • As a base for further LoRA finetuning on style-specific datasets.
  • As a prompt generator inside T2I pipelines.

Out-of-Scope Use

  • General-purpose chat.
  • Safety-critical applications.

How to Get Started

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

REPO_ID = "KavinduHansaka/Llama-3.2-3B-ImageGen"

tok = AutoTokenizer.from_pretrained(REPO_ID)
model = AutoModelForCausalLM.from_pretrained(
    REPO_ID, device_map="auto", torch_dtype=torch.bfloat16
)

prompt = "Create a cinematic noir macro photo with film grain, 1:1 ratio, sharp focus."
inputs = tok(prompt, return_tensors="pt").to(model.device)

out = model.generate(**inputs, max_new_tokens=120, do_sample=True, temperature=0.5, top_p=0.9)
print(tok.decode(out[0], skip_special_tokens=True))

Training Details

  • Training data: prompt-gen-8k-flux-sdxl
  • Training method: LoRA with PEFT, adapters merged into base model.
  • Precision: bfloat16/float16 during training.

Technical Specifications

  • Architecture: LLaMA 3.2 (3B parameters)
  • Hardware: NVIDIA GPU ≥6 GB VRAM
  • Dependencies: transformers, peft, accelerate, torch, sentencepiece

Citation

@misc{llama3.2-3B,
title = {LLaMA 3.2 (3B)},
author = {Meta AI},
year = {2024},
url = {https://huggingface.co/meta-llama/Llama-3.2-3B}
}

@misc{llama3.2-3B-ImageGen,
  title  = {Llama-3.2-3B Image Prompt Generator (LoRA Merged)},
  author = {Kavindu Hansaka Jayasinghe},
  year   = {2025},
  url    = {https://huggingface.co/KavinduHansaka/Llama-3.2-3B-ImageGen}
}
Downloads last month
6
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for KavinduHansaka/Llama-3.2-3B-ImageGen

Adapter
(279)
this model
Adapters
1 model

Dataset used to train KavinduHansaka/Llama-3.2-3B-ImageGen

Evaluation results