Prediction
yorickvp/llava-v1.6-mistral-7b:19be067bInput
- top_p
- 1
- prompt
- Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int
- history
- []
- max_tokens
- 1024
- temperature
- 0.2
{
"image": "https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png",
"top_p": 1,
"prompt": "Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int",
"history": [],
"max_tokens": 1024,
"temperature": 0.2
}
npm install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run yorickvp/llava-v1.6-mistral-7b using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"yorickvp/llava-v1.6-mistral-7b:19be067b589d0c46689ffa7cc3ff321447a441986a7694c01225973c2eafc874",
{
input: {
image: "https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png",
top_p: 1,
prompt: "Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int",
max_tokens: 1024,
temperature: 0.2
}
}
);
console.log(output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run yorickvp/llava-v1.6-mistral-7b using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"yorickvp/llava-v1.6-mistral-7b:19be067b589d0c46689ffa7cc3ff321447a441986a7694c01225973c2eafc874",
input={
"image": "https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png",
"top_p": 1,
"prompt": "Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int",
"max_tokens": 1024,
"temperature": 0.2
}
)
# The yorickvp/llava-v1.6-mistral-7b model can stream output as it's running.
# The predict method returns an iterator, and you can iterate over that output.
for item in output:
# https://replicate.com/yorickvp/llava-v1.6-mistral-7b/api#output-schema
print(item, end="")
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Run yorickvp/llava-v1.6-mistral-7b using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "19be067b589d0c46689ffa7cc3ff321447a441986a7694c01225973c2eafc874",
"input": {
"image": "https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png",
"top_p": 1,
"prompt": "Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int",
"max_tokens": 1024,
"temperature": 0.2
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
brew install cog
If you don’t have Homebrew, there are other installation options available.
Run this to download the model and run it in your local environment:
cog predict r8.im/yorickvp/llava-v1.6-mistral-7b@sha256:19be067b589d0c46689ffa7cc3ff321447a441986a7694c01225973c2eafc874 \
-i 'image="https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png"' \
-i 'top_p=1' \
-i 'prompt="Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int"' \
-i 'max_tokens=1024' \
-i 'temperature=0.2'
To learn more, take a look at the Cog documentation.
Run this to download the model and run it in your local environment:
docker run -d -p 5000:5000 --gpus=all r8.im/yorickvp/llava-v1.6-mistral-7b@sha256:19be067b589d0c46689ffa7cc3ff321447a441986a7694c01225973c2eafc874
curl -s -X POST \ -H "Content-Type: application/json" \ -d $'{ "input": { "image": "https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png", "top_p": 1, "prompt": "Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int", "max_tokens": 1024, "temperature": 0.2 } }' \ http://localhost:5000/predictions
To learn more, take a look at the Cog documentation.
Output
{
"completed_at": "2024-07-11T03:27:12.533752Z",
"created_at": "2024-07-11T03:27:09.654000Z",
"data_removed": false,
"error": null,
"id": "s24aeawxasrgj0cgkzabtj53rc",
"input": {
"image": "https://replicate.delivery/pbxt/LFOkHr2gGAdPNIanHgR9W4NpYaMSyL605eBBtmTIhZ2ZYu9F/Screenshot%202024-07-11%20at%208.56.55%20AM.png",
"top_p": 1,
"prompt": "Reply in json format with the following keys - containsLines : True or False, colorsOfLines: array of str, numberOfLines: int, numberOfIntersectionPointsBetweenLines: int",
"history": [],
"max_tokens": 1024,
"temperature": 0.2
},
"logs": "The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.\nSetting `pad_token_id` to `eos_token_id`:2 for open-end generation.",
"metrics": {
"predict_time": 2.844614506,
"total_time": 2.879752
},
"output": [
"```json\n",
"{\n",
" ",
"\"containsLines\": ",
"true,\n",
" ",
"\"colorsOfLines\": ",
"[\"red\", ",
"\"blue\"],\n",
" ",
"\"numberOfLines\": ",
"4,\n",
" ",
"\"numberOfIntersectionPointsBetweenLines\": ",
"2\n",
"}\n",
"``` "
],
"started_at": "2024-07-11T03:27:09.689137Z",
"status": "succeeded",
"urls": {
"stream": "https://streaming-api.svc.us.c.replicate.net/v1/streams/k2a347dg4q275be4grjiw2xqhw6v73edhqqqedknea3sb76zba3q",
"get": "https://api.replicate.com/v1/predictions/s24aeawxasrgj0cgkzabtj53rc",
"cancel": "https://api.replicate.com/v1/predictions/s24aeawxasrgj0cgkzabtj53rc/cancel"
},
"version": "19be067b589d0c46689ffa7cc3ff321447a441986a7694c01225973c2eafc874"
}
The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
Setting `pad_token_id` to `eos_token_id`:2 for open-end generation.