The way to Run Your Own LLaMA Download LLaMA Weights Arrange Conda and create an environment for LLaMA Create env and install dependencies Create a swapfile Run the models Add custom prompts Level Up Coding

-

  1. Open a terminal and run: wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  2. Run chmod +x Miniconda3-latest-Linux-x86_64.sh
  3. Run ./Miniconda3-latest-Linux-x86_64.sh
  4. Go along with the default options. When it shows you the license, hit q to proceed the installation.
  5. Refresh your shell by logging out and logging in back again.
  1. Create an env: conda create -n llama
  2. Activate the env: conda activate llama
  3. Install the dependencies:
    NVIDIA:
    conda install torchvision torchaudio pytorch-cuda=11.7 git -c pytorch -c nvidia
    AMD:
    pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.2
  4. Clone the INT8 repo by the user tloen: git clone https://github.com/tloen/llama-int8 && cd llama-int8
  5. Install the necessities: pip install -r requirements.txt pip install -e .
  1. Create a swapfile: sudo dd if=/dev/zero of=/swapfile bs=4M count=13000 status=progress This can create about ~50GB swapfile. Edit the count to your preference. 13000 means 4MBx13000.
  2. Mark it as swap: sudo mkswap /swapfile
  3. Activate it: sudo swapon /swapfile
  1. Open a terminal in your llama-int8 folder (the one you cloned).
  2. Run: python example.py --ckpt_dir ~/Downloads/LLaMA/7B --tokenizer_path ~/Downloads/LLaMA/tokenizer.model --max_batch_size=1
  3. You’re done. Wait for the model to complete loading and it’ll generate a prompt.
  1. Open the example.py file within the llama-int8 directory.
  2. Navigate to line 136. It starts with triple quotations, """.
  3. Replace the present prompt with whatever you may have in mind.

ASK DUKE

What are your thoughts on this topic?
Let us know in the comments below.

2 COMMENTS

0 0 votes
Article Rating
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

2
0
Would love your thoughts, please comment.x
()
x