Skip to content

MaxDLink/GPT2

Repository files navigation

Here’s a README.md file that explains how to clone the repository, set up the submodules, and run the LLM (Language Model) on a local machine.

# Llama-Folder LLM Setup

This repository contains the setup for running an LLM using the `llama.cpp` implementation and the `Open Llama 3B` model. The project is organized using Git submodules to include external repositories.

## Table of Contents
- [Prerequisites](#prerequisites)
- [Cloning the Repository](#cloning-the-repository)
- [Setting Up Submodules](#setting-up-submodules)
- [Converting Hugging Face Model](#converting-hugging-face-model)
- [Running the LLM](#running-the-llm)
- [Troubleshooting](#troubleshooting)
- [License](#license)

## Prerequisites

Before you begin, ensure you have the following installed:
- **Git**: Version control system
- **CMake**: Required to build `llama.cpp`
- **Python 3.x**: Needed for model conversion scripts
- **GCC**: GNU Compiler Collection (installed via Homebrew)
- **Hugging Face Account**: To download models from Hugging Face

## Cloning the Repository

To get started, clone the repository along with its submodules:

```bash
git clone --recurse-submodules https://github.com/MaxDLink/GPT2.git
cd GPT2

This command will clone the main repository and all the submodules (i.e., llama.cpp and Open Llama 3B).

Setting Up Submodules

If you forget to use the --recurse-submodules flag during cloning, you can initialize and update the submodules manually:

git submodule update --init --recursive

This command will pull in the necessary submodules.

Converting Hugging Face Model

Before running the LLM, you need to convert the Hugging Face model to a format compatible with llama.cpp. If you haven't already, follow these steps:

  1. Navigate to the llama.cpp directory:

    cd llama-folder/llama.cpp
  2. Run the conversion script:

    python convert_hf_to_gguf.py --model ../open_llama_3b --outfile ./models/3B/

    This will convert the model and store it in the ./models/3B/ directory.

Running the LLM

Once the model is converted, you can run the LLM using the following command:

  1. Navigate to the llama.cpp/build/bin directory:

    cd build/bin
  2. Run the LLM with a prompt:

    ./llama-cli -m ../../models/3B/Open_Llama_3B-3.4B-F16.gguf -p "What is the capital of France?"

    This command will execute the model and provide a response to the given prompt.

Troubleshooting

If you encounter any issues, consider the following tips:

  • Out of Memory: If your machine runs out of memory, consider using a smaller model or running on a machine with more RAM.
  • Model Not Found: Ensure the model file paths are correct and the conversion was successful.
  • Submodule Issues: If the submodules are not initializing, try git submodule update --init --recursive again.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


This README file provides the necessary steps for setting up and running the LLM on your local machine. If you have any questions or issues, feel free to open an issue on the GitHub repository.


This `README.md` should guide a new user through the entire process, from cloning the repository to running the LLM locally.

About

Train GPT2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages