Downloads · 30 days
17
11% of all-time downloads
kawchar85/SmolLM2-135M-Instruct-TIFA
SmolLM2-135M-Instruct-TIFA is a text generation model from kawchar85. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
SmolLM2-135M-Instruct-TIFA is a fine-tuned version of HuggingFaceTB/SmolLM2-135M-Instruct specifically trained for TIFA (Text-to-Image Faithfulness Assessment). This model generates structured evaluation questions to…
Downloads · 30 days
17
11% of all-time downloads
All-time downloads
157
Public
Parameters
135M
269 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors269 MB · 98%
From the Hugging Face model README
SmolLM2-135M-Instruct-TIFA is a fine-tuned version of HuggingFaceTB/SmolLM2-135M-Instruct specifically trained for TIFA (Text-to-Image Faithfulness Assessment). This model generates structured evaluation questions to assess how faithfully text-to-image models represent given text descriptions.
This model is designed to automatically generate evaluation questions for text-to-image models by creating four specific types of questions:
Training Method: Supervised Fine-Tuning (SFT) with LoRA
LoRA Configuration:
["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]Training Parameters:
The model was trained on a structured dataset containing 5,000 examples created using Gemini, formatted as conversation data in JSONL format.
pip install transformers torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
model_path = "kawchar85/SmolLM2-135M-Instruct-TIFA"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.float16,
trust_remote_code=True,
device_map="auto"
)
# Create pipeline
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device=0 if torch.cuda.is_available() else -1,
return_full_text=False,
)
# Generate evaluation questions
description = "khaki triangles and azure crescents"
user_msg = (
f"Create 4 questions to evaluate a text-to-image model's faithfulness to this description: "
f'"{description}".\n'
"The first question should have 'no' as the answer, "
"the second and third questions should have answers that are a single word directly taken "
"from the description, and the fourth question should have 'yes' as the answer."
)
messages = [{"role": "user", "content": user_msg}]
output = pipe(
messages,
max_new_tokens=256,
do_sample=False,
)
print(output[0]["generated_text"])
For the description "khaki triangles and azure crescents", the model generates:
Q1: Are the triangles green?
Choices: ['no', 'yes']
Answer: no
Q2: What color are the triangles?
Choices: ['blue', 'red', 'khaki', 'green']
Answer: khaki
Q3: What shape are the objects?
Choices: ['squares', 'circles', 'crescents', 'triangles']
Answer: crescents
Q4: Are there azure crescents in the image?
Choices: ['no', 'yes']
Answer: yes
@misc{smollm2-135m-it-tifa-2025,
title={SmolLM2-135M-Instruct-TIFA: A Fine-tuned Model for Text-to-Image Faithfulness Assessment},
author={kawchar85},
year={2025},
url={https://huggingface.co/kawchar85/SmolLM2-135M-Instruct-TIFA}
}