defaultGive me a short introduction to large language model.
typetext
{
"max_new_tokens": 512,
"model_type": "Qwen2-0.5B-Instruct",
"prompt": "Tell me a funny joke about cowboys in the style of Yoda from star wars",
"repetition_penalty": 1,
"system_prompt": "You are a funny and helpful assistant.",
"temperature": 1,
"top_k": 1,
"top_p": 1
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_78D**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run zsxkib/qwen2-0.5b-instruct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"zsxkib/qwen2-0.5b-instruct:f45376a2df2570a076816e9f9c1713d63a5e52851026fa836f14886585591350",
{
input: {
max_new_tokens: 512,
model_type: "Qwen2-0.5B-Instruct",
prompt: "Tell me a funny joke about cowboys in the style of Yoda from star wars",
repetition_penalty: 1,
system_prompt: "You are a funny and helpful assistant.",
temperature: 1,
top_k: 1,
top_p: 1
}
}
);
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=r8_78D**********************************
This is your API token. Keep it to yourself.
import replicate
Run zsxkib/qwen2-0.5b-instruct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"zsxkib/qwen2-0.5b-instruct:f45376a2df2570a076816e9f9c1713d63a5e52851026fa836f14886585591350",
input={
"max_new_tokens": 512,
"model_type": "Qwen2-0.5B-Instruct",
"prompt": "Tell me a funny joke about cowboys in the style of Yoda from star wars",
"repetition_penalty": 1,
"system_prompt": "You are a funny and helpful assistant.",
"temperature": 1,
"top_k": 1,
"top_p": 1
}
)
# The zsxkib/qwen2-0.5b-instruct 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/zsxkib/qwen2-0.5b-instruct/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=r8_78D**********************************
This is your API token. Keep it to yourself.
Run zsxkib/qwen2-0.5b-instruct 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": "zsxkib/qwen2-0.5b-instruct:f45376a2df2570a076816e9f9c1713d63a5e52851026fa836f14886585591350",
"input": {
"max_new_tokens": 512,
"model_type": "Qwen2-0.5B-Instruct",
"prompt": "Tell me a funny joke about cowboys in the style of Yoda from star wars",
"repetition_penalty": 1,
"system_prompt": "You are a funny and helpful assistant.",
"temperature": 1,
"top_k": 1,
"top_p": 1
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Why did the cowgirl refuse to ride the horse? Because she was afraid of the horse's horn!
{
"id": "n20fq4zmk5rgm0cg9yqv9jex9c",
"model": "zsxkib/qwen2-0.5b-instruct",
"version": "f45376a2df2570a076816e9f9c1713d63a5e52851026fa836f14886585591350",
"input": {
"max_new_tokens": 512,
"model_type": "Qwen2-0.5B-Instruct",
"prompt": "Tell me a funny joke about cowboys in the style of Yoda from star wars",
"repetition_penalty": 1,
"system_prompt": "You are a funny and helpful assistant.",
"temperature": 1,
"top_k": 1,
"top_p": 1
},
"logs": "Using seed: 627241552\nTime to first token: 0.67 seconds\nTotal generation time: 1.10 seconds\nTotal tokens generated: 89\nThroughput: 81.23 tokens/second",
"output": [
"",
"Why ",
"did ",
"the ",
"",
"cowgirl ",
"refuse ",
"to ",
"ride ",
"the ",
"",
"horse? ",
"Because ",
"she ",
"was ",
"afraid ",
"of ",
"the ",
"",
"horse's ",
"",
"",
"horn!"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-06-25T13:57:29.881Z",
"started_at": "2024-06-25T14:00:58.068325Z",
"completed_at": "2024-06-25T14:00:59.267657Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/n20fq4zmk5rgm0cg9yqv9jex9c/cancel",
"get": "https://api.replicate.com/v1/predictions/n20fq4zmk5rgm0cg9yqv9jex9c",
"stream": "https://streaming-api.svc.us.c.replicate.net/v1/streams/agvamlzsq5yigvv4yqbprrjyoqivuz7tkj534mmcway34762gopq",
"web": "https://replicate.com/p/n20fq4zmk5rgm0cg9yqv9jex9c"
},
"metrics": {
"predict_time": 1.199332183,
"total_time": 209.386657
}
}