from transformers import AutoModelForImageTextToText, AutoProcessor model_name = "oOundefinedOo/Qwen3-0.6B-VL" model = AutoModelForImageTextToText.from_pretrained(model_name, dtype="auto", device_map="auto")processor = AutoProcessor.from_pretrained(model_name) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"}, {"type": "text", "text": "Describe this image."}, ], }] inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt", enable_thinking=False, # True switches on the thinking mode, as in Qwen3).to(model.device) generated_ids = model.generate(**inputs, max_new_tokens=512)output_ids = generated_ids[0][len(inputs["input_ids"][0]):].tolist() # parse the thinking content (empty when thinking is off)try: index = len(output_ids) - output_ids[::-1].index(151668) # rindex of </think>except ValueError: index = 0thinking_content = processor.decode(output_ids[:index], skip_special_tokens=True).strip("\n")content = processor.decode(output_ids[index:], skip_special_tokens=True).strip("\n")print("thinking content:", thinking_content)print("content:", content)