Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code samples invalid for llama-3.2-11b-vision-instruct Workers AI Model #19185

Open
thomas-desmond opened this issue Jan 13, 2025 · 0 comments
Open
Assignees
Labels
content:edit Request for content edits documentation Documentation edits product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/

Comments

@thomas-desmond
Copy link
Contributor

Existing documentation URL(s)

https://developers.cloudflare.com/workers-ai/models/llama-3.2-11b-vision-instruct/

What changes are you suggesting?

All of the code samples for the llama-3.2-11b-vision-instruct Workers AI model do not work. At its most basic, the model is for image recognition, and the sample code never handles an image.

Something similar to this image-to-text model may be better: https://developers.cloudflare.com/workers-ai/models/uform-gen2-qwen-500m/.

I was able to get the following JavaScript code sample to execute in a Worker, however, I'd want someone else to confirm the code is following the best practices for this model:

const res = await fetch("https://cataas.com/cat");
const blob = await res.arrayBuffer();
const encodedImage = [...new Uint8Array(blob)]


const response = await env.AI.run('@cf/meta/llama-3.2-11b-vision-instruct',
  {
	  image: encodedImage,
	  prompt: 'Tell me what is in the image.',
  },
);

I also have concerns about the Parameters section (https://developers.cloudflare.com/workers-ai/models/llama-3.2-11b-vision-instruct/#Parameters). It's not clear to me whether you need to have Prompt and Messages as input parameters for the model. Based on testing, you can only have one or the other, not both. But nothing states that in the documentation. And if you can only have one why would you choose one over the other?

Additional information

No response

@thomas-desmond thomas-desmond added documentation Documentation edits content:edit Request for content edits labels Jan 13, 2025
@github-actions github-actions bot added the product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/ label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:edit Request for content edits documentation Documentation edits product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/
Projects
None yet
Development

No branches or pull requests

6 participants