INTEGRITY Dokumentace

Veřejné adaptéry LoRA

Cloudflare nabízí několik veřejných adaptérů LoRA, které lze ihned použít pro doladěnou inferenci. Můžete si je hned vyzkoušet prostřednictvím našeho playground.

Veřejné adaptéry LoRA budou mít název cf-public-x, a prefix zůstane vyhrazen pro Cloudflare.

Název Popis Kompatibilní s
cf-public-magicoder Programovací úlohy ve více jazycích @cf/mistral/mistral-7b-instruct-v0.1
@hf/mistral/mistral-7b-instruct-v0.2
cf-public-jigsaw-classification Klasifikace toxických komentářů @cf/mistral/mistral-7b-instruct-v0.1
@hf/mistral/mistral-7b-instruct-v0.2
cf-public-cnn-summarization Shrnutí článků @cf/mistral/mistral-7b-instruct-v0.1
@hf/mistral/mistral-7b-instruct-v0.2

Tyto veřejné adaptéry LoRA můžete také vypsat pomocí volání API:

Požadovaná oprávnění API tokenu

Alespoň jeden z následujících oprávnění tokenu je povinné:
Seznam veřejných Finetunes
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai/finetunes/public" \
	--request GET \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"

Spouštění inference s veřejnými adaptéry LoRA

Chcete-li spouštět inferenci s veřejnými LoRAs, stačí v požadavku uvést název LoRA.

Doporučujeme použít promptovou šablonu, na které byl LoRA natrénován. Najdete ji v repozitářích HuggingFace odkazovaných výše u každého adaptéru.

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",
});