shishirpatil
commited on
Commit
•
aad45bc
1
Parent(s):
929b736
Update Model Card
Browse files
README.md
CHANGED
@@ -1,3 +1,85 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- api
|
7 |
+
datasets:
|
8 |
+
- gorilla-llm/APIBench
|
9 |
---
|
10 |
+
# Gorilla: Large Language Model Connected with Massive APIs
|
11 |
+
By Shishir G. Patil, Tianjun Zhang, Xin Wang, and Joseph E. Gonzalez ([Project Website](https://shishirpatil.github.io/gorilla/))
|
12 |
+
|
13 |
+
[![arXiv](https://img.shields.io/badge/arXiv-2305.15334-<COLOR>.svg?style=flat-square)](https://arxiv.org/abs/2305.15334) [![Discord](https://img.shields.io/discord/1111172801899012102?label=Discord&logo=discord&logoColor=green&style=flat-square)](https://discord.gg/3apqwwME) [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1DEBPsccVLF_aUnmD0FwPeHFrtdC0QIUP?usp=sharing)
|
14 |
+
|
15 |
+
`Gorilla` enables LLMs to use tools by invoking APIs. Given a natural language query, Gorilla can write a semantically- and syntactically- correct API to invoke. With Gorilla, we are the first to demonstrate how to use LLMs to invoke 1,600+ (and growing) API calls accurately while reducing hallucination. We also release APIBench, the largest collection of APIs, curated and easy to be trained on! Join us, as we try to expand the largest API store and teach LLMs how to write them! Hop on our Discord, or open a PR, or email us if you would like to have your API incorporated as well.
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
|
19 |
+
Gorilla can be either trained via standard finetuning or using our novel retriever-aware training pipeline. We release `gorilla-7b-hf-delta-v1`, a 0-shot finetuned LLM that can reliably use Hugging Face APIs. It can be prompted through simply natural language (e.g., "I want to generate an image from text."). Checkour our website, github and paper for more information.
|
20 |
+
Thank you for the feedback, with `gorilla-llm/gorilla-7b-hf-delta-v1` Gorilla now ouput's code snippet that can be directly integrated into your workflow!
|
21 |
+
|
22 |
+
Now with `gorilla-llm/gorilla-7b-hf-delta-v1`
|
23 |
+
|
24 |
+
Example prompt1: "I would like to translate 'I feel very good today.' from English to Chinese."
|
25 |
+
|
26 |
+
🦍 Response:
|
27 |
+
|
28 |
+
```
|
29 |
+
from transformers import pipeline
|
30 |
+
def load_model():
|
31 |
+
translation_model = pipeline(‘translation_en_to_zh’, model=‘Helsinki-NLP/opus-mt-en-zh’)
|
32 |
+
return translation_model
|
33 |
+
def process_data(text_to_translate, translation_model):
|
34 |
+
response = translation_model(text_to_translate)[0][‘translation_text’]
|
35 |
+
return response
|
36 |
+
text_to_translate = ‘I feel very good today’
|
37 |
+
# Load the model
|
38 |
+
translation_model = load_model()
|
39 |
+
# Process the data
|
40 |
+
translated_text = process_data(text_to_translate, translation_model)
|
41 |
+
print(translated_text)
|
42 |
+
```
|
43 |
+
|
44 |
+
Example prompt2: "I want to build a robot that can detecting objects in an image ‘cat.jpeg’. Input: [‘cat.jpeg’]"
|
45 |
+
|
46 |
+
🦍 Response:
|
47 |
+
|
48 |
+
```
|
49 |
+
from transformers import ConvNextFeatureExtractor, ConvNextForImageClassification
|
50 |
+
from PIL import Image
|
51 |
+
def load_model():
|
52 |
+
feature_extractor = ConvNextFeatureExtractor.from_pretrained(‘facebook/convnext-large-224’)
|
53 |
+
model = ConvNextForImageClassification.from_pretrained(‘facebook/convnext-large-224’)
|
54 |
+
return feature_extractor, model
|
55 |
+
def process_data(image_path, feature_extractor, model):
|
56 |
+
image = Image.open(image_path)
|
57 |
+
inputs = feature_extractor(images=image, return_tensors=‘pt’)
|
58 |
+
logits = model(**inputs).logits
|
59 |
+
predicted_label = logits.argmax(-1).item()
|
60 |
+
response = model.config.id2label[predicted_label]
|
61 |
+
return response
|
62 |
+
image_path = ‘/content/cat.jpeg’
|
63 |
+
# Load the model and feature extractor
|
64 |
+
feature_extractor, model = load_model()
|
65 |
+
# Process the data
|
66 |
+
response = process_data(image_path, feature_extractor, model)
|
67 |
+
print(response)
|
68 |
+
```
|
69 |
+
|
70 |
+
### Model Type
|
71 |
+
|
72 |
+
Gorilla is an open-source API caller trained by fine-tuning LLaMA weights. It is an auto-regressive language model, based on the transformer architecture.
|
73 |
+
Gorilla also has Apache 2.0 models trained on MPT-7B and Falcon-7B base, which cab be used commercially with no obligations.
|
74 |
+
|
75 |
+
### Model Date
|
76 |
+
|
77 |
+
06/15/2023
|
78 |
+
|
79 |
+
### Organization
|
80 |
+
|
81 |
+
Gorilla LLM (UC Berkeley)
|
82 |
+
|
83 |
+
---
|
84 |
+
license: apache-2.0
|
85 |
+
---
|