← Cloudflare Workers AI / workers-ai / features / fine-tunes
Публичные адаптеры LoRA
Cloudflare предлагает несколько публичных адаптеров LoRA, которые можно сразу использовать для вывода с тонкой настройкой. Вы можете сразу опробовать их через наш playground ↗.
Публичные LoRA будут иметь имя cf-public-x, и префикс будет зарезервирован за Cloudflare.
| Название | Описание | Совместимо с |
|---|---|---|
| cf-public-magicoder ↗ | Задачи программирования на нескольких языках | @cf/mistral/mistral-7b-instruct-v0.1 @hf/mistral/mistral-7b-instruct-v0.2 |
| cf-public-jigsaw-classification ↗ | Классификация токсичных комментариев | @cf/mistral/mistral-7b-instruct-v0.1 @hf/mistral/mistral-7b-instruct-v0.2 |
| cf-public-cnn-summarization ↗ | Суммаризация статей | @cf/mistral/mistral-7b-instruct-v0.1 @hf/mistral/mistral-7b-instruct-v0.2 |
Также эти публичные LoRA можно получить списком с помощью вызова API:
Необходимые разрешения API-токена
Хотя бы одно из следующих права доступа токена требуется:Workers AI WriteWorkers AI Read
Список публичных Finetunes
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai/finetunes/public" \
--request GET \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"Запуск инференса с публичными LoRA
Чтобы выполнить инференс с использованием публичных LoRA, достаточно указать имя LoRA в запросе.
Рекомендуем использовать тот шаблон промпта, на котором обучалась LoRA. Его можно найти в репозиториях HuggingFace, указанных выше для каждого адаптера.
cURL
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/@cf/mistral/mistral-7b-instruct-v0.1 \
--header 'Authorization: Bearer {cf_token}' \
--data '{
"messages": [
{
"role": "user",
"content": "Write a python program to check if a number is even or odd."
}
],
"lora": "cf-public-magicoder"
}'JavaScript
const answer = await env.AI.run("@cf/mistral/mistral-7b-instruct-v0.1", {
stream: true,
raw: true,
messages: [
{
role: "user",
content:
"Summarize the following: Some newspapers, TV channels and well-known companies publish false news stories to fool people on 1 April. One of the earliest examples of this was in 1957 when a programme on the BBC, the UKs national TV channel, broadcast a report on how spaghetti grew on trees. The film showed a family in Switzerland collecting spaghetti from trees and many people were fooled into believing it, as in the 1950s British people didn't eat much pasta and many didn't know how it was made! Most British people wouldnt fall for the spaghetti trick today, but in 2008 the BBC managed to fool their audience again with their Miracles of Evolution trailer, which appeared to show some special penguins that had regained the ability to fly. Two major UK newspapers, The Daily Telegraph and the Daily Mirror, published the important story on their front pages.",
},
],
lora: "cf-public-cnn-summarization",
});