Views
No views yet
1{
2 "global_step": 7000,
3 "epoch": 2.911837350180693,
4 "total_flos": 4.786937654858951e+18,
5 "train_loss": ".751"
6}1from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
2from PIL import Image
3import torch
4
5# Load model and processor
6model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
7 "qwen25-vl-weather-7b",
8 torch_dtype=torch.float16,
9 device_map="auto"
10)
11processor = AutoProcessor.from_pretrained("qwen25-vl-weather-7b")
12
13# Prepare your weather image
14image = Image.open("weather_image.jpg")
15
16# Create a prompt
17prompt = "Analyze this weather image and describe the meteorological conditions."
18
19# Format the message
20messages = [
21 {
22 "role": "user",
23 "content": [
24 {"type": "image"},
25 {"type": "text", "text": prompt}
26 ]
27 }
28]
29
30# Process the input
31text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
32inputs = processor(
33 text=[text],
34 images=[image],
35 padding=True,
36 return_tensors="pt"
37).to(model.device)
38
39# Generate response
40generated_ids = model.generate(**inputs, max_new_tokens=512)
41generated_ids_trimmed = [
42 out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
43]
44output_text = processor.batch_decode(
45 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
46)[0]
47
48print(output_text)1@misc{weather-qwen25vl-2025,
2 title={Weather Analysis Vision-Language Model based on Qwen2.5-VL-7B},
3 author={Deepguess},
4 year={2025},
5 publisher={HuggingFace},
6 url={https://huggingface.co/qwen25-vl-weather-7b}
7}