Update chameleon.md — fix runtime type error (#33494)

Update chameleon.md

Fix error

RuntimeError: Input type (float) and bias type (c10::BFloat16) should be the same
This commit is contained in:
Max Buckley
2024-09-17 13:32:49 +02:00
committed by GitHub
parent 74026b473e
commit ac5a0556f1

View File

@@ -78,7 +78,7 @@ url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw) image = Image.open(requests.get(url, stream=True).raw)
prompt = "What do you see in this image?<image>" prompt = "What do you see in this image?<image>"
inputs = processor(prompt, image, return_tensors="pt").to(model.device) inputs = processor(prompt, image, return_tensors="pt").to(model.device, dtype=torch.bfloat16)
# autoregressively complete prompt # autoregressively complete prompt
output = model.generate(**inputs, max_new_tokens=50) output = model.generate(**inputs, max_new_tokens=50)