-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Website] Added content for Connecting Llama via Hugging Face
- Loading branch information
Arvind Nagalingam
committed
Mar 25, 2024
1 parent
f50ad94
commit 3d369e5
Showing
18 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
docs/docs/connecting-your-llm/connecting-llama-via-huggingface.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Connecting to Llama via Hugging Face | ||
|
||
To connect CP4M to Llama via Hugging Face, you will need: | ||
1. A Hugging Face account | ||
2. Access to the Llama model from Meta | ||
|
||
## Sign up for a Hugging Face account | ||
Hugging Face is a platform that helps you build, deploy, and train machine learning models. You can sign up for an account [here](https://huggingface.co/join). | ||
|
||
![Hugging Face Home Page](./img/hugging-face-home-page.png) | ||
|
||
## Accessing the Llama model on Hugging Face | ||
Hugging Face has a large repository of machine learning models for a variety of use cases accessible [here](https://huggingface.co/models). | ||
|
||
You can search for the LLama model from Meta of your choice. For the purposes of this tutorial, we will be using the [LLama-2-7b-chat-hf model](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf). | ||
|
||
In order to use the Llama model, you will need to accept the Llama 2 Community License Agreement on the [model page](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf). | ||
|
||
![Gated model agremeent](./img/hugging-face-gated-model-agreement.png) | ||
|
||
Once your account is approved, the model page will inform you that you have been granted access. | ||
|
||
![Gated model access](./img/hugging-face-gated-model-access.png) | ||
|
||
## Deploying model using Inference API | ||
The fastest way to deploy Llama is through Hugging Face's serverless Inference API. | ||
|
||
1. Go to the [Llama model page](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf). | ||
2. On the top right, click on the **Deploy** dropdown button. | ||
|
||
![Model Deploy](./img/hugging-face-model-deploy.png) | ||
|
||
|
||
3. In the dropdown, click the **Inference API (serverless)** option. *Note: Using Inference API requires a [Hugging Face Pro subscription](https://huggingface.co/pricing)*. | ||
|
||
![Inference API First Time](./img/hugging-face-inference-api-first-time.png) | ||
|
||
4. On the new modal, click the **Token** dropdown then click **+ New access token**. | ||
|
||
![Inference API New Token](./img/hugging-face-inference-api-new-token.png) | ||
|
||
5. On the access tokens page, click the **New Token** button. | ||
|
||
![Access Token Page](./img/hugging-face-access-token.png) | ||
|
||
6. Create a new access token with the **Write** permission. | ||
|
||
![Create Access Token Modal](./img/hugging-face-create-access-token.png) | ||
|
||
7. Go back to the Model Deploy > Inference API page [here](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf?inference_api=true). Your newly created access token should now be populated in the **Token** section. | ||
|
||
## Updating your CP4M config from Inference API | ||
7. Copy and paste the *API_URL* on the Deploy Inference API modal to your CP4M config file in the "\[\[plugins]] endpoint" entry. If you are using the Llama-2-7b-chat-hf model, it should be "https://api-inference.huggingface.co/models/meta-llama/Llama-2-7b-chat-hf". | ||
|
||
![Inference API code](./img/hugging-face-inference-api-code.png) | ||
|
||
8. Click **Show API token**. Copy and paste this API token to your CP4M config file in the "\[\[plugins]] api_key" entry. | ||
|
||
Congratulations! You have now successfully set up CP4M with Llama via Hugging Face. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Connecting to OpenAI | ||
|
||
Coming soon... |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+94.7 KB
docs/docs/connecting-your-llm/img/hugging-face-create-access-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.1 KB
docs/docs/connecting-your-llm/img/hugging-face-gated-model-access.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.5 KB
docs/docs/connecting-your-llm/img/hugging-face-gated-model-agreement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+329 KB
docs/docs/connecting-your-llm/img/hugging-face-inference-api-first-time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+338 KB
docs/docs/connecting-your-llm/img/hugging-face-inference-api-new-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
docs/docs/messaging-integrations/connecting-to-instagram-direct.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Connecting to Instagram Direct | ||
|
||
Coming soon... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Connecting to Whatsapp | ||
|
||
Coming soon... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters