Downloads · 30 days
18
20% of all-time downloads
asdfghjkl2421/Qwen3-VL-8B-NSFW-Caption-V4.5
Qwen3-VL-8B-NSFW-Caption-V4.5 is a image-text-to-text model from asdfghjkl2421. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
18
20% of all-time downloads
All-time downloads
91
Public
Parameters
8.8B
17.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors17.5 GB · 100%
From the Hugging Face model README
欢迎加入 Discord 进行友好交流。
thesby/Qwen3-VL-8B-NSFW-Caption-V4.5 是一个专为高质量图像描述(Image Captioning)而优化的多模态大模型。该模型基于强大的 Qwen/Qwen3-VL-8B-Instruct 进行Lora微调,旨在提供卓越的图像理解和描述生成能力。
我们在一个包含约 200 万 高质量图文对的混合数据集上对模型进行了训练,使其在多个维度上都表现出色。
使用 vllm 可以获得更好的性能,请参考脚本:get_vlm_caption.py
transformers 使用方式和 Qwen/Qwen3-VL-8B-Instruct 完全相同,模型在图片最大尺寸 800*800 微调,遵从这一设置可以获得更好的效果。
from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
# default: Load the model on the available device(s)
model = Qwen3VLForConditionalGeneration.from_pretrained(
"thesby/Qwen3-VL-8B-NSFW-Caption-V4.5", dtype="auto", device_map="auto"
)
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
# model = Qwen3VLForConditionalGeneration.from_pretrained(
# "thesby/Qwen3-VL-8B-NSFW-Caption-V4.5",
# dtype=torch.bfloat16,
# attn_implementation="flash_attention_2",
# device_map="auto",
# )
processor = AutoProcessor.from_pretrained("thesby/Qwen3-VL-8B-NSFW-Caption-V4.5")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "请用自然流畅的中文对以下图片进行全面而详细的描述。包括所有可见元素及其属性(如颜色、大小、形状、质地),它们的空间关系,以及任何显著特征或上下文。确保用自然流畅的中文描述清晰、生动,能够捕捉图片的每一个方面,不遗漏任何重要细节。"},
],
}
]
# Preparation for inference
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt"
)
inputs = inputs.to(model.device)
# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=2048)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
视频只需要将按照 fps=1 抽帧作为图片放入 messages 即可。
本模型在一个精心构建的、约 200 万 图文对的数据集上进行了微调。该数据集经过严格的筛选和清洗,混合了:
Qwen/Qwen3-VL-8B-Instruct