Gorilla LLM通過提高精度、減少幻覺錯誤、節(jié)省時間和工作量、增強可靠性以及處理有約束的API等方面的優(yōu)勢,為開發(fā)人員提供了更高效、準確和可靠的API調(diào)用生成能力。

2.5、為什么基于 LLaMA 微調(diào)圖片

目前來看,流行的開源模型非常多,Gorilla 為什么選擇 LLaMA 而不是其他模型?是否對多個模型進行了微調(diào)和測試?之所以選擇 LLaMA 作為起點,因為它被認為是開源LLM的主力。許多其他模型都是其針對特定應(yīng)用的衍生模型。當然,Gorilla 也使用了 GPT-4、GPT-3.5 和 Claude-v1 對 Gorilla 進行了基準測試。因為考慮到開源模型可商用的情況,后續(xù)又發(fā)布了兩款基于 MPT-7B 和 Falcon-7B 的 Gorilla 模型?,F(xiàn)在 Gorilla 模型使用 Apache 2.0 許可證,這意味著 Gorilla 可以在沒有任何約束的情況下用于商業(yè)用途!

2.6、訓(xùn)練 Gorilla 的基本條件圖片

訓(xùn)練 Gorilla 需要的硬件條件據(jù)官方介紹使用 8 個 A100 40GB GPU 節(jié)點來訓(xùn)練和評估所有模型。根據(jù)模型和 API 數(shù)據(jù)集的不同,所需時間差異很大。最短的運行總計大約 10 個 GPU 小時,而最長的運行大約 120 個 GPU 小時。同時訓(xùn)練過程也使用了所有最先進的計算技術(shù)(高效的注意力機制)內(nèi)存優(yōu)化(分片、檢查點和混合精度訓(xùn)練)。沒有使用 LoRA,所有 Gorilla 模型都經(jīng)過端到端微調(diào)。

三、Gorilla 的基本原理

Gorilla LLM 接受過海量 API 文檔和代碼數(shù)據(jù)集的培訓(xùn)。該數(shù)據(jù)集包括來自各種不同平臺的 API 調(diào)用,例如 Google Cloud Platform、Amazon Web Services 和 Microsoft Azure。 Gorilla 使用此數(shù)據(jù)集來學(xué)習(xí) API 調(diào)用的語法和語義。當你要求 Gorilla 生成 API 調(diào)用時,它會首先嘗試在其數(shù)據(jù)集中查找匹配的 API 調(diào)用。如果它找到匹配的 API 調(diào)用,它將簡單地返回該調(diào)用。如果它沒有找到匹配的 API 調(diào)用,它將根據(jù)其對 API 語法和語義的了解生成新的 API 調(diào)用。以下是 Gorilla 連接 API 的過程涉及幾個關(guān)鍵步驟:

  1. 用戶提示:用戶提供自然語言提示,描述他們希望使用 API 實現(xiàn)的特定任務(wù)或目標。
  2. 檢索(可選):在檢索模式下,Gorilla 使用文檔檢索器(例如 BM25 或 GPT-Index)從數(shù)據(jù)庫中獲取最新的 API 文檔。然后,該文檔會與用戶提示符連接起來,并附有一條消息,指示 Gorilla 使用它作為參考。
  3. API 調(diào)用生成:Gorilla 處理用戶提示(以及檢索到的文檔,如果適用)以生成滿足用戶任務(wù)或目標的適當 API 調(diào)用。這是通過 Gorilla 經(jīng)過微調(diào)的 LLaMA-7B 模型實現(xiàn)的,該模型專為 API 調(diào)用而設(shè)計。
  4. 輸出:Gorilla 將生成的 API 調(diào)用返回給用戶,然后可用于與所需的 API 進行交互并完成指定的任務(wù)。

值得注意的是,Gorilla 具有很強的適應(yīng)性,可以在零樣本檢索模式下運行,使其能夠適應(yīng) API 文檔的變化并隨著時間的推移保持準確性。第一個(也是最流行的)是零樣本模式。在這種情況下,Gorilla 以自然語言接受用戶的查詢,并返回正確的 API 進行調(diào)用?,F(xiàn)在,在很多場景中,您經(jīng)常會看到 API 隨著時間的推移而演變 – 這可能是版本控制,或者端點可能會發(fā)生變化,或者參數(shù)可能會被重新洗牌,或者其中一些可能會被棄用。為了使我們的系統(tǒng)對此具有魯棒性,我們引入了第二種使用 Gorilla 的模式 – 檢索器感知。在這種情況下,Gorilla 會選擇最相關(guān)的 API,然后將其附加到用戶的提示中。這使我們能夠了解 API 的變化。

四、如何安裝 Gorilla LLM

要使用 Gorilla LLM,必須安裝 Python 3.10 或更高版本。早期版本的 Python 無法編譯。 

4.1、安裝 Conda圖片

如果是全新的服務(wù)器,首次需要安裝Conda,在終端中,使用以下命令下載Miniconda安裝腳本:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

使用以下命令運行安裝腳本:

bash Miniconda3-latest-Linux-x86_64.sh

按照安裝程序的提示進行安裝。您可以選擇安裝位置和環(huán)境變量設(shè)置等選項。安裝完成后,使用以下命令激活conda環(huán)境:

 source ~/.bashrc

使用以下命令檢查conda是否成功安裝:

conda --version

如果conda成功安裝,您將看到conda的版本號,我這里安裝的是conda 23.5.2。

4.2、安裝 Gorilla圖片

4.2.1、安裝依賴項:

conda create -n gorilla python=3.10
conda activate gorilla
pip install -r requirements.txt

4.2.2、安裝 Gorilla Delta 配重:

https://huggingface.co/docs/transformers/main/model_doc/llama

https://huggingface.co/gorilla-llm/gorilla-7b-hf-delta-v1

4.2.3、使用增量權(quán)重:

將以下 Python 命令中的占位符替換為正確的文件路徑:

python3 apply_delta.py 
--base-model-path path/to/hf_llama/ 
--target-model-path path/to/gorilla-falcon-7b-hf-v0 
--delta-path path/to/models--gorilla-llm--gorilla-7b-hf-delta-v1

使用此命令將增量權(quán)重應(yīng)用于您的 LLaMA 模型。

4.2.4、使用 CLI 進行推理:

python3 serve/gorilla_falcon_cli.py --model-path path/to/gorilla-falcon-7b-hf-v0
# 如果您在使用 Apple 芯片(M1、M2 等)的 Mac 上運行,請?zhí)砑?nbsp;“--device mps”

4.3、Gorilla 代碼結(jié)構(gòu)圖片

4.3.1、data 文件夾包含各種數(shù)據(jù)集,包括 API 文檔和社區(qū)貢獻的 APIBench 數(shù)據(jù)集。

4.3.2、eval 文件夾包含評估代碼和輸出。

4.3.3、inference 文件夾包含用于本地運行 Gorilla 的代碼。

您可以參考每個文件夾中的自述文件,以獲取有關(guān)使用提供的代碼和數(shù)據(jù)集的更具體說明和信息。

五、如何使用 Gorilla LLM

首先,使用pip安裝OpenAI

pip install openai

像這樣配置 api_key 和 api_base

import openai

openai.api_key = "EMPTY" # key可以忽略
openai.api_base = "http://34.132.127.197:8000/v1" #http://zanino.millennium.berkeley.edu:8000/v1
 

5.1、文本翻譯圖片

使用 OpenAI 庫創(chuàng)建獲取 Gorilla 結(jié)果的函數(shù)

def get_gorilla_response(prompt="我想把英語翻譯成中文。", model="gorilla-falcon-7b-hf-v0"):
    completion = openai.ChatCompletion.create(
      model=model,
      messages=[{"role": "user", "content": prompt}]
    )
    return completion.choices[0].message.content

執(zhí)行發(fā)送提示的函數(shù)和您想要使用的模型,在本例中為 gorilla-falcon-7b-hf-v0。

prompt = "我想從英語翻譯成中文。"
print(get_gorilla_response(prompt, model="gorilla-falcon-7b-hf-v0" ))

就是這樣。然后,您將收到來自 Huggingface API 的完整信息以及有關(guān)如何執(zhí)行該請求的說明。

<<<domain>>>: Natural Language Processing Translation 
<<<api_call>>>: pipeline('translation_en_to_zh', model='Helsinki-NLP/opus-mt-en-zh') <<<api_provider>>>: Hugging Face Transformers 
<<<explanation>>>: 
1. Import the pipeline function from the transformers library provided by Hugging Face.
2. Use the pipeline function to create a translation model, specifying the model 'Helsinki-NLP/opus-mt-en-zh' to be loaded. This model is trained to translate text from English to Chinese.
3. Pass your English text to the translator object, and it will return the translated Chinese text.

Gorilla HuggingFace Demo:https://huggingface.co/spaces/davila7/try-gorilla?source=post_page

5.2、對象檢測圖片

# 對象檢測
prompt = "我想構(gòu)建一個可以檢測圖像“cat.jpeg”中對象的機器人。輸入:['cat.jpeg']"
print(get_gorilla_response(prompt, model="gorilla-falcon-7b-hf-v0"))

輸出結(jié)果:

<<<domain>>>: Computer Vision Object Detection
<<<api_call>>>: model = DetrForObjectDetection.from_pretrained('facebook/detr-resnet-101-dc5')
<<<api_provider>>>: Hugging Face Transformers
<<<explanation>>>: 1. Import the necessary components from the Hugging Face Transformers library, torch, and PIL (Python Imaging Library).
2. Open the image using PIL's Image.open() function with the provided image path.
3. Initialize the pretrained DETR (DEtection TRansformer) model and the image processor.
4. Generate inputs for the model using the image processor.
5. Pass the inputs to the model, which returns object detection results.
<<<code>>>:

from transformers import AutoFeatureExtractor, AutoModelForObjectDetection
from PIL import Image
import torch

def load_model():
    feature_extractor = AutoFeatureExtractor.from_pretrained('facebook/detr-resnet-101-dc5')
    model = AutoModelForObjectDetection.from_pretrained('facebook/detr-resnet-101-dc5')
    return feature_extractor, model

def process_data(image_path, feature_extractor, model):
    image = Image.open(image_path)
    inputs = feature_extractor(images=image, return_tensors='pt')
    outputs = model(**inputs)
    results = feature_extractor.post_process(outputs, threshold=0.6)[0]
    response = [model.config.id2label[label.item()] for label in results['labels']]
    return response

image_path = 'cat.jpeg'

# Load the model and feature extractor
feature_extractor, model = load_model()

# Process the data
response = process_data(image_path, feature_extractor, model)
print(response)

5.3、從 Torch Hub 調(diào)用 API圖片

# Torch Hub 翻譯
prompt = "我想把英語翻譯成漢語。"
print(get_gorilla_response(prompt, model="gorilla-falcon-7b-hf-v0"))

輸出結(jié)果:

{'domain': 'Machine Translation', 'api_call': \"model = torch.hub.load('pytorch/fairseq

六、基于 Gorrilla API 微調(diào) ChatGPT-3.5

在 Gorilla api 數(shù)據(jù)集上微調(diào) ChatGPT-3.5 以嘗試提高其性能,關(guān)于OpenAI ChatGPT-3.5 微調(diào)文檔可以訪問這里:

https://platform.openai.com/docs/guides/fine-tuning注意:這個微調(diào)腳本將在 OpenAI 上訓(xùn)練 720 萬個 token,需要花費一定的費用,請在繼續(xù)之前先考慮清楚是否愿意支付這筆費用。

6.1、安裝依賴圖片

pip install openai tiktoken
import re
import os
import json
import openai
from pprint import pprint
openai_api_key = "OPENAI API KEY"
openai.api_key = openai_api_key

6.2、準備數(shù)據(jù)集圖片

下載 Gorrilla Huggingface api 訓(xùn)練數(shù)據(jù),可以在這里找到所有 Gorilla 訓(xùn)練數(shù)據(jù):https://github.com/ShishirPatil/gorilla/tree/main/data/apibench

wget https://raw.githubusercontent.com/ShishirPatil/gorilla/cab053ba7fdf4a3286c0e75aa2bf7abc4053812f/data/apibench/huggingface_train.json

6.2.1、加載數(shù)據(jù)

data = []
with open("huggingface_train.json", "r") as file:
  # data = json.load(file)
  for line in file:
        item = json.loads(line.strip())
        data.append(item)

# 這是與訓(xùn)練有關(guān)的數(shù)據(jù)
data[0]["code"]

6.2.2、數(shù)據(jù)解析

解析訓(xùn)練數(shù)據(jù)指令

def parse_instructions_and_outputs(code_section):

  sections = code_section.split('###')
  for section in sections:
      if "Instruction:" in section:
          instruction = section.split("Instruction:", 1)[1].strip()
          break

  domain = re.search(r'<<<domain>>>(.*?)\n', code_section, re.IGNORECASE).group(1).lstrip(': ')
  api_call = re.search(r'<<<api_call>>>(.*?)\n', code_section, re.IGNORECASE).group(1).lstrip(': ')
  api_provider = re.search(r'<<<api_provider>>>(.*?)\n', code_section, re.IGNORECASE).group(1).lstrip(': ')

  if "<<<explanation>>>" in code_section:
    explanation_pattern = r'<<<explanation>>>(.*?)(?:\n<<<code>>>|``|$)'<br>    explanation = re.search(explanation_pattern, code_section, re.DOTALL).group(1).lstrip(': ')<br>  <strong>else</strong>:<br>    explanation = <strong>None</strong><br><br>  # 考慮兩種情況提取代碼片段<br>  code_pattern = r'(?:<<<code>>>`) (.*)'  # 匹配 <<<code>>> 或 ``
  code_snippet_match = re.search(code_pattern, code_section, re.DOTALL)
  code_snippet = code_snippet_match.group(1).lstrip(': ') if code_snippet_match else None

  return instruction, domain, api_call, api_provider, explanation, code_snippet
def encode_train_sample(data, api_name):
    """將多個提示指令編碼為單個字符串。"""
    code_section = data['code']

    if "<<<api_call>>>" in code_section:
      instruction, domain, api_call, api_provider, explanation, code = parse_instructions_and_outputs(code_section)

      prompts = []

      #prompt = instruction + "\nWrite a python program in 1 to 2 lines to call API in " + api_name + ".\n\nThe answer should follow the format: <<<domain>>> $DOMAIN, <<<api_call>>>: $API_CALL, <<<api_provider>>>: $API_PROVIDER, <<<explanation>>>: $EXPLANATION, <<<code>>>: $CODE}. Here are the requirements:\n" + domains + "\n2. The $API_CALL should have only 1 line of code that calls api.\n3. The $API_PROVIDER should be the programming framework used.\n4. $EXPLANATION should be a step-by-step explanation.\n5. The $CODE is the python code.\n6. Do not repeat the format in your answer."

      prompts.append({"role": "system", "content": "你是一個有厲害的API開發(fā)人員,可以根據(jù)需求編寫API。"})
      prompts.append({"role": "user", "content": instruction})
      prompts.append({"role": "assistant", "content": f"<<<domain>>> {domain},\
<<<api_call>>>: {api_call}, <<<api_provider>>>: {api_provider}, <<<explanation>>>: {explanation}, <<<code>>>: {code}"})
      return prompts
    else:
      return None

使用正確的格式格式化訓(xùn)練樣本以反映 Gorilla 論文

encoded_data = []
none_count = 0
for d in data:
  res = encode_train_sample(d, "huggingface")
  if res is not None:
    encoded_data.append({"messages":res})
  else:
    none_count += 1

print(f"{none_count} samples out of {len(data)} ignored")

打印將傳遞給 OpenAI 進行微調(diào)的樣本

encoded_data[3]

輸出結(jié)果:

{'messages': [{'role': 'system',
   'content': 'You are a helpful API writer who can write APIs based on requirements.'},
  {'role': 'user',
   'content': 'I run an online art store and I want to classify the art pieces uploaded by the users into different categories like abstract, landscape, portrait etc.'},
  {'role': 'assistant',
   'content': "<<<domain>>> Computer Vision Image Classification,<<<api_call>>>: ViTModel.from_pretrained('facebook/dino-vits8'), <<<api_provider>>>: Hugging Face Transformers, <<<explanation>>>: 1. We first import the necessary classes from the transformers and PIL packages. This includes ViTModel for the image classification model and Image for processing image data.\n2. We then use the from_pretrained method of the ViTModel class to load the pre-trained model 'facebook/dino-vits8'. This model has been trained using the DINO method which is particularly useful for getting good features for image classification tasks.\n3. We load the image data from an uploaded image file by the user.\n4. This model can then be used to classify the image into different art categories like 'abstract', 'landscape', 'portrait' etc., <<<code>>>: None"}]}

6.3、OpenAI數(shù)據(jù)驗證腳本圖片

# 我們從導(dǎo)入所需的包開始

import json
import os
import tiktoken
import numpy as np
from collections import defaultdict

# 接下來,我們指定數(shù)據(jù)通路并打開JSONL文件

data_path = encoded_file_path

# 加載數(shù)據(jù)集
with open(data_path) as f:
    dataset = [json.loads(line) for line in f]

# 我們可以通過檢查示例數(shù)量和第一項來快速檢查數(shù)據(jù)

# 初始數(shù)據(jù)集統(tǒng)計信息
print("Num examples:", len(dataset))
print("First example:")
for message in dataset[0]["messages"]:
    print(message)

# 現(xiàn)在我們對數(shù)據(jù)有了了解,我們需要遍歷所有不同的示例并檢查以確保格式正確并與Chat完成消息結(jié)構(gòu)匹配

# 格式錯誤檢查
format_errors = defaultdict(int)

for ex in dataset:
    if not isinstance(ex, dict):
        format_errors["data_type"] += 1
        continue

    messages = ex.get("messages", None)
    if not messages:
        format_errors["missing_messages_list"] += 1
        continue

    for message in messages:
        if "role" not in message or "content" not in message:
            format_errors["message_missing_key"] += 1

        if any(k not in ("role", "content", "name") for k in message):
            format_errors["message_unrecognized_key"] += 1

        if message.get("role", Nonenot in ("system", "user", "assistant"):
            format_errors["unrecognized_role"] += 1

        content = message.get("content", None)
        if not content or not isinstance(content, str):
            format_errors["missing_content"] += 1

    if not any(message.get("role", None) == "assistant" for message in messages):
        format_errors["example_missing_assistant_message"] += 1

if format_errors:
    print("Found errors:")
    for k, v in format_errors.items():
        print(f"{k}: {v}")
else:
    print("No errors found")

# 除了消息的結(jié)構(gòu)之外,我們還需要確保長度不超過4096令牌限制。

# Token 計數(shù)功能
encoding = tiktoken.get_encoding("cl100k_base")

def num_tokens_from_messages(messages, tokens_per_message=3, tokens_per_name=1):
    num_tokens = 0
    for message in messages:
        num_tokens += tokens_per_message
        for key, value in message.items():
            num_tokens += len(encoding.encode(value))
            if key == "name":
                num_tokens += tokens_per_name
    num_tokens += 3
    return num_tokens

def num_assistant_tokens_from_messages(messages):
    num_tokens = 0
    for message in messages:
        if message["role"] == "assistant":
            num_tokens += len(encoding.encode(message["content"]))
    return num_tokens

def print_distribution(values, name):
    print(f"\n#### Distribution of {name}:")
    print(f"min / max: {min(values)}, {max(values)}")
    print(f"mean / median: {np.mean(values)}, {np.median(values)}")
    print(f"p5 / p95: {np.quantile(values, 0.1)}, {np.quantile(values, 0.9)}")

# 最后,在繼續(xù)創(chuàng)建微調(diào)作業(yè)之前,我們可以查看不同格式化操作的結(jié)果:

# 警告和token計數(shù)
n_missing_system = 0
n_missing_user = 0
n_messages = []
convo_lens = []
assistant_message_lens = []

for ex in dataset:
    messages = ex["messages"]
    if not any(message["role"] == "system" for message in messages):
        n_missing_system += 1
    if not any(message["role"] == "user" for message in messages):
        n_missing_user += 1
    n_messages.append(len(messages))
    convo_lens.append(num_tokens_from_messages(messages))
    assistant_message_lens.append(num_assistant_tokens_from_messages(messages))

print("缺少系統(tǒng)消息的示例數(shù):", n_missing_system)
print("缺少用戶消息的數(shù)字示例:", n_missing_user)
print_distribution(n_messages, "num_messages_per_example")
print_distribution(convo_lens, "num_total_tokens_per_example")
print_distribution(assistant_message_lens, "num_assistant_tokens_per_example")
n_too_long = sum(l > 4096 for l in convo_lens)
print(f"\n{n_too_long} 示例可能超過4096令牌限制,它們將在微調(diào)期間被截斷")

# 定價和違約n_epochs估計
MAX_TOKENS_PER_EXAMPLE = 4096

MIN_TARGET_EXAMPLES = 100
MAX_TARGET_EXAMPLES = 25000
TARGET_EPOCHS = 3
MIN_EPOCHS = 1
MAX_EPOCHS = 25

n_epochs = TARGET_EPOCHS
n_train_examples = len(dataset)
if n_train_examples * TARGET_EPOCHS < MIN_TARGET_EXAMPLES:
    n_epochs = min(MAX_EPOCHS, MIN_TARGET_EXAMPLES // n_train_examples)
elif n_train_examples * TARGET_EPOCHS > MAX_TARGET_EXAMPLES:
    n_epochs = max(MIN_EPOCHS, MAX_TARGET_EXAMPLES // n_train_examples)

n_billing_tokens_in_dataset = sum(min(MAX_TOKENS_PER_EXAMPLE, length) for length in convo_lens)
print(f"數(shù)據(jù)集有~{n_billing_tokens_in_dataset}個令牌,在訓(xùn)練期間將收取費用")
print(f"默認情況下,您將在此數(shù)據(jù)集上訓(xùn)練{n_epochs}個紀元")
print(f"默認情況下,您將收取~{n_epochs*n_billing_tokens_in_dataset}代幣的費用")
print("請參閱定價頁面以估算總成本")

6.4、開始微調(diào)GPT-3.5圖片

創(chuàng)建 OpenAI 訓(xùn)練文件

openai.File.create(
  file=open(encoded_file_path, "rb"),
  purpose='fine-tune'
)

創(chuàng)建微調(diào)任務(wù)

openai.api_key = openai_api_key
openai.FineTuningJob.create(
    training_file="file-OrxAP7HcvoSUmu9MtAbWo5s4",
    model="gpt-3.5-turbo"
)
# 列出 10 個微調(diào)任務(wù)
openai.FineTuningJob.list(limit=10)

# 查詢微調(diào)的狀態(tài)
state = openai.FineTuningJob.retrieve("ftjob-qhg4yswil15TCqD4SNHn0V1D")
state["status"], state["trained_tokens"], state["finished_at"]

# 列出微調(diào)作業(yè)中最多 10 個事件
openai.FineTuningJob.list_events(id="ftjob-qhg4yswil15TCqD4SNHn0V1D", limit=10)

6.5、使用微調(diào)后的模型圖片

openai.api_key = openai_api_key

completion = openai.ChatCompletion.create(
  model="ft:gpt-3.5-turbo:my-org:custom_suffix:id",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "How can i load a NER model?"}
  ]
)

print(completion.choices[0].message)
print(completion.choices[0].message["content"])

輸出結(jié)果:

('To load a Named Entity Recognition (NER) model in Python, you can use the '
 "Hugging Face Transformers library. Here's a step-by-step guide to loading "
 'and using a NER model:\n'
 '\n'
 '1. Install the required Hugging Face Transformers library using "pip install '
 'transformers".\n'
 '2. Import the AutoModelForTokenClassification class from the transformers '
 'library.\n'
 '3. Import the necessary tokenizer as well, which is AutoTokenizer in this '
 'case.\n'
 '4. Use the from_pretrained method to load the pre-trained model with its '
 'respective model name or identifier.\n'
 '5. Then, use the load_tokenizer method to load the tokenizer.\n'
 '6. Encode your text using the loaded tokenizer, specifying the '
 "'return_tensors' parameter as 'pt'.\n"
 '7. Pass the input tensor to the model and it will return the predictions, '
 'describing the Named Entities in the text.\n'
 '\n'
 'Please keep in mind that you should download the model first, replace '
 "'YOUR_MODEL_NAME' with an appropriate model identifier, and make sure to "
 'execute this code on a suitable device (e.g., CPU or GPU).\n'
 '\n'
 'Here is how the code looks:\n'
 '``python\n'<br> 'from transformers import AutoModelForTokenClassification, AutoTokenizer\n'<br> 'import torch\n'<br> '\n'<br> "model = AutoModelForTokenClassification.from_pretrained('YOUR_MODEL_NAME')\n"<br> "tokenizer = AutoTokenizer.from_pretrained('YOUR_MODEL_NAME')\n"<br> '\n'<br> '# Encode your text using the loaded tokenizer\n'<br> "inputs = tokenizer(text, return_tensors='pt')\n"<br> '\n'<br> '# Pass the input tensor to the model and obtain NER predictions\n'<br> 'predictions = model(**inputs)\n'<br> '``\n'
 '\n'
 "Remember to replace 'YOUR_MODEL_NAME' with an appropriate BERT NER-trained "
 "model such as 'dslim/bert-base-NER'.")

七、總結(jié)

Gorilla LLM 是一個突破性的LLM,可以生成準確的 API 調(diào)用并適應(yīng)文檔的實時變化。該模型為未來的LLM在與工具和系統(tǒng)交互方面變得更加可靠和多功能鋪平了道路。Gorilla LLM 是一款面向開發(fā)人員的強大新工具。它可以節(jié)省開發(fā)人員的時間和精力,并且可以幫助他們編寫更可靠的代碼。如果您是一名開發(fā)人員,建議你可以了解一下 Gorilla LLM。LLM未來的進步可以集中在進一步減少幻覺錯誤、提高對不同 API 的適應(yīng)性以及擴展其處理復(fù)雜任務(wù)的能力。潛在的應(yīng)用包括充當計算基礎(chǔ)設(shè)施的主要接口、自動化度假預(yù)訂等流程以及促進各種 Web API 之間的無縫通信。

八、References

https://shishirpatil.github.io/gorilla/

https://github.com/ShishirPatil/gorilla

https://arxiv.org/abs/2305.15334

文章轉(zhuǎn)自微信公眾號@技術(shù)狂潮AI

 

熱門推薦
一個賬號試用1000+ API
助力AI無縫鏈接物理世界 · 無需多次注冊
3000+提示詞助力AI大模型
和專業(yè)工程師共享工作效率翻倍的秘密
返回頂部
上一篇
Springboot集成LLM大模型API
下一篇
LangChain+通義千問+AnalyticDB向量引擎保姆級教程
国内精品久久久久影院日本,日本中文字幕视频,99久久精品99999久久,又粗又大又黄又硬又爽毛片
亚洲欧美一区二区久久| 亚洲一区二区四区蜜桃| 国产精品自拍av| 懂色av一区二区三区免费观看| 精品一区二区三区在线视频| 成人黄色片在线观看| 欧美日本韩国一区二区三区视频| 精品国一区二区三区| 亚洲高清免费在线| 国产精品一区二区免费不卡| 色域天天综合网| 欧美激情自拍偷拍| 国产成人啪午夜精品网站男同| 成人一区在线看| 国产精品国产三级国产aⅴ入口| 中文字幕免费不卡| 久久99精品久久久久久国产越南 | 亚洲成人你懂的| 不卡一区中文字幕| 成人欧美一区二区三区1314| 国产呦精品一区二区三区网站| 欧美视频一区二区三区四区| 国产精品青草综合久久久久99| 麻豆91在线播放免费| 欧美成人性战久久| 美腿丝袜在线亚洲一区| 91麻豆精品国产91久久久使用方法| 亚洲精品视频自拍| 555www色欧美视频| 久久精品一区二区三区四区| 亚洲精品成人悠悠色影视| 欧美日韩成人激情| 久久久久久9999| 国产成人综合亚洲网站| 亚洲亚洲精品在线观看| 欧美一区二区视频在线观看2022 | 成人av片在线观看| 国产精品福利一区二区| 69堂成人精品免费视频| 久久se这里有精品| 欧美一区二区在线不卡| 亚洲综合丝袜美腿| 东方aⅴ免费观看久久av| 日精品一区二区| 国产精品视频免费| 日韩欧美国产综合| 91在线小视频| 成人免费高清在线观看| 天堂影院一区二区| 舔着乳尖日韩一区| 亚洲激情自拍视频| 亚洲欧美日韩小说| 日韩码欧中文字| 亚洲视频一二三区| 日韩理论片中文av| 亚洲天堂久久久久久久| 欧美亚洲日本国产| 制服丝袜中文字幕亚洲| 欧美成人在线直播| 91极品视觉盛宴| 精品夜夜嗨av一区二区三区| 亚洲色图欧洲色图| 7777精品伊人久久久大香线蕉| 国产精品影音先锋| 日韩不卡手机在线v区| 国产女人水真多18毛片18精品视频| 丁香婷婷综合色啪| 在线观看欧美精品| 国产精品中文字幕日韩精品 | 免费成人性网站| 欧洲视频一区二区| 国产无一区二区| 一区二区三区中文字幕电影| 黄色精品一二区| 欧洲国内综合视频| 欧美韩日一区二区三区四区| 亚洲综合视频在线| 成人免费福利片| 国产精品高清亚洲| 国产在线视频一区二区| 制服丝袜av成人在线看| 亚洲精品视频在线观看网站| 成人综合婷婷国产精品久久| 久久综合资源网| 悠悠色在线精品| 色网站国产精品| 夜夜嗨av一区二区三区中文字幕| 在线精品视频一区二区三四| 91精品国产免费| 国产一二三精品| 亚洲精品国产品国语在线app| 99re成人精品视频| 欧美aa在线视频| 日韩精品在线一区| 一区二区三区在线播| 91免费看`日韩一区二区| 亚洲一区二区在线播放相泽| 91精品国产美女浴室洗澡无遮挡| 免费观看久久久4p| 亚洲精品ww久久久久久p站| 欧美剧在线免费观看网站| 亚洲国产精品久久不卡毛片| 欧美性生活久久| 国产一区免费电影| 极品瑜伽女神91| 亚洲国产一二三| 久久综合九色综合欧美就去吻| 成人av在线播放网站| 日本人妖一区二区| 亚洲在线视频免费观看| 亚洲男同性视频| jlzzjlzz亚洲日本少妇| 麻豆精品久久精品色综合| 亚洲啪啪综合av一区二区三区| 欧美另类一区二区三区| 国产一区二区毛片| 韩国v欧美v亚洲v日本v| 肉丝袜脚交视频一区二区| 亚洲精品大片www| 一区二区在线看| 亚洲成人av电影在线| 中文字幕国产一区二区| 色综合久久久久网| 欧美精品一二三区| 日韩一区二区精品葵司在线| 粉嫩13p一区二区三区| av亚洲精华国产精华精华 | 亚洲一区免费在线观看| 五月天一区二区| 日本欧美肥老太交大片| 日韩成人精品在线| 成人黄色网址在线观看| 欧美精品久久久久久久多人混战 | 在线观看欧美黄色| 美女爽到高潮91| 日本特黄久久久高潮| 国产免费观看久久| 欧美日韩国产天堂| 国产福利精品一区二区| 91影院在线免费观看| 在线欧美日韩国产| 91香蕉视频污| 日韩亚洲欧美在线观看| 久久精品欧美一区二区三区麻豆| 国产精品少妇自拍| 日韩精品电影在线| 欧美视频一区二| 国产精品欧美精品| 狠狠色综合播放一区二区| 欧美视频精品在线观看| 一区二区三区精品在线观看| 99久久精品免费看国产 | 欧美日韩一区不卡| 一级精品视频在线观看宜春院| 国产一区二区三区国产| 欧美mv日韩mv| 亚洲另类在线制服丝袜| 亚洲永久免费av| 色诱亚洲精品久久久久久| 免费人成在线不卡| 久久久99精品免费观看不卡| 激情久久久久久久久久久久久久久久| 欧美不卡视频一区| 国产在线精品一区二区夜色| 91在线无精精品入口| 亚洲二区在线观看| 精品国产乱码久久| 一本一本久久a久久精品综合麻豆| 久久久久久久久久久久久夜| 欧洲色大大久久| 丁香网亚洲国际| 韩国成人福利片在线播放| 一区视频在线播放| 精品成人佐山爱一区二区| 欧美日韩在线观看一区二区 | 国产精品成人免费在线| 欧美日韩一级二级| 99re免费视频精品全部| 亚洲精选免费视频| 国产欧美日韩另类视频免费观看| 日韩精品中文字幕在线一区| 日韩欧美视频在线 | 亚洲区小说区图片区qvod| 久久久久88色偷偷免费| 精品国产乱码久久久久久影片| 91精品国产高清一区二区三区 | 一级女性全黄久久生活片免费| 亚洲黄色小视频| 亚洲综合小说图片| 亚洲制服欧美中文字幕中文字幕| 欧美精品一区二区三区很污很色的| 国产精品亚洲视频| 国产成人午夜精品5599| 一区av在线播放| 丝袜亚洲精品中文字幕一区| 三级一区在线视频先锋| 中文字幕 久热精品 视频在线| 久久久久久久久伊人| 日韩美女啊v在线免费观看| 亚洲国产精品一区二区尤物区|