Views
No views yet
<think> and <answer> tags1import torch
2from transformers import AutoModel, AutoTokenizer
3from PIL import Image
4
5model = AutoModel.from_pretrained(
6 "aadex/Earthmind-R1",
7 trust_remote_code=True,
8 torch_dtype=torch.bfloat16,
9 device_map="auto"
10)
11tokenizer = AutoTokenizer.from_pretrained("aadex/Earthmind-R1", trust_remote_code=True)
12
13# Prepare for generation
14model.preparing_for_generation(tokenizer=tokenizer, max_new_tokens=512, torch_dtype=torch.bfloat16)
15
16# Load your image
17image = Image.open("your_image.jpg")
18
19# Create prompt
20question = "Describe what you see in this satellite image."
21prompt = f"""User: <image>
22{question} First output the thinking process in <think> </think> tags and then output the final answer in <answer> </answer> tags.
23Assistant:"""
24
25# Generate (use model's chat method or manual generation)
26response = model.chat(tokenizer, pixel_values, question, generation_config)
27print(response)