avatarAmy @GrabNGoInfo

Summary

This tutorial guides users on how to access Llama 2, a free and open-source generative AI large language model developed by Meta, as an alternative to ChatGPT API.

Abstract

The article provides a step-by-step guide for users to access Llama 2, a free and open-source generative AI large language model developed by Meta. Llama 2 uses public data for its training, and users can apply for access to the model by filling out a form on Meta's official website. Once approved, users can download the models to their local drive or via Hugging Face. The tutorial also provides instructions on how to verify a Hugging Face account to access Llama 2 models and generate an access token for downloading the model.

Opinions

  • Llama 2 is a valuable alternative to ChatGPT API for those interested in finding a free and open-source generative AI large language model.
  • The tutorial assumes that users have some technical knowledge and experience with AI and machine learning.
  • The tutorial recommends downloading the models via Hugging Face, which allows users to use the models with an online cloud notebook such as Google Colab.
  • The tutorial emphasizes the importance of ensuring that the email used to fill out Meta's application form matches the email used for the Hugging Face account.
  • The tutorial notes that access to Llama 2 models is granted almost immediately after filling out the application form on Meta's website.
  • The tutorial recommends users to refresh their Hugging Face page for the selected model after receiving the access email to ensure they can access the model.
  • The tutorial mentions that the model "meta-llama/Llama-2-7b-chat-hf" is a fine-tuned version of the "meta-llama/Llama-2-7b" model and users will get access to all the variations of this model.

How to access Llama 2: Free Generative AI LLM Alternative to ChatGPT API

Step-by-step tutorial to get Llama 2 API tokens for absolute beginners

Image by Amy @GrabNGoInfo

Llama 2 is a group of large language models (LLMs) developed by Meta. It is an open-source model freely available for research and commercial use. If you are interested in finding a free alternative to the ChatGPT API, Llama 2 is worth checking out. In this tutorial, we will go through how to get access to Llama 2 generative AI large language models (LLMs).

Resources for this post:

  • Video tutorial for this post on YouTube
  • More video tutorials on GenAI
  • More blog posts on GenAI

Step 0: Llama 2 Training Data

Llama 2 used public data that includes about 2 trillion tokens for the model. The fine-tuning phase incorporated publicly accessible instructional datasets, complemented by over a million new human-annotated examples.

Regarding data recency, the pretraining data is capped at September 2022, whereas some of the tuning data extends to July 2023.

Step 1: Fill Out Meta’s Application Form

Request access to the models in the official Meta Llama 2 repository by filling out the access form on Meta’s website.

Access is granted almost immediately, and you will receive an email looking like the one below at the address which you signed up with.

Step 2: Llama 2 models Download Options

After getting access to Llama 2 models, you have two options to download the Llama 2 models.

  1. Download the models to your local drive following the instructions in the email. Doing this requires a computer with a large hard drive and a good GPU.
  2. Download the model via Hugging Face. You can use it with an online cloud notebook such as Google Colab. Read this blog post by Hugging Face to learn more about the Llama 2 models hosted on Hugging Face. In this tutorial, we will focus on the second method.

Step 3: Llama 2 models Hugging Face Verification

Login to your Hugging Face account and go to the Models section, then search for the models with the name llama.

We can see that the model named meta-llama/Llama-2–7b-chat-hf has the highest download volume. Click the model name and you will see a form for accessing Llama 2 on Hugging Face.

If you agree with the statements, please submit the form by clicking the Submit button. Note that your Hugging Face account email must match the email you used in step 1 when filling out Meta’s application form.

After submitting the Hugging Face Llama 2 access form, you will see a blue box with the message “Your request to access this repo has been successfully submitted, and is pending a review from the repo’s authors.” Within a couple of hours, you will receive an email granting access to the Llama 2 model.

The model meta-llama/Llama-2–7b-chat-hf is a fine-tuned version of the meta-llama/Llama-2–7b model, and you will get access to all the variations of this model.

Now refresh your Hugging Face page for the selected model, and you will see a message saying “You have been granted access to this model”.

Step 4: Get Hugging Face Access Token

We need a Hugging Face access token associated with the verified account before downloading the model. To get the Hugging Face token, click the profile picture on the upper right corner, then click Settings.

After that, click Access Tokens on the left sidebar.

Then click New Token on the Access Tokens page.

Give your new token a name, choose the role, and click Generate a token button.

You can copy the token after it is successfully generated, and Llama 2 is ready to use!

More tutorials are available on GrabNGoInfo YouTube Channel, GrabNGoInfo.com, and LinkedIn.

Should you find this article enjoyable, show your appreciation on Medium with claps and comments. Don’t forget to hit the follow button for more content like this. Unlock unlimited access to a world of knowledge — become a Medium member today through my referral link and empower your learning journey!

Recommended Tutorials

References

Llama 2
Generative Ai Tools
Llm
Large Language Models
Genai
Recommended from ReadMedium