Git Product home page Git Product logo

open_llama_7b_hands_on's Introduction

"open_llama_7b_preview_300bt" hands-on

I have tried open_llama_7b_preview_300bt. I don't fully understand it yet, but I can confirm that it works as a first look.

Download models

I will use the model as a hugging face model. To do this, I first need to download the complete set of models. This is because the repository also contains other models, and the model for huggingface is one level down in the directory.

cd sandbox
git clone https://huggingface.co/openlm-research/open_llama_7b_preview_300bt

Use models as hugging face models

It appears that one level down is the huggingface model as follows

model_path ="/home/user/sandbox/open_llama_7b_preview_300bt/open_llama_7b_preview_300bt_transformers_weights"

Setup environment

conda update -n base -c defaults conda --yes
conda create --yes -n env-op-llama
conda activate env-op-llama
conda install python=3.10.10 --yes
python -m pip install --upgrade pip

Install packages

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
pip install accelerate transformers
pip install SentencePiece

Run

python main.py

Play on Youtube

View on youtube

Tuning

params = {
        "prompt": prompt,.
        "temperature": 0.5, # The closer to 0, the sharper the probability distribution and the less variation
        "max_new_tokens": 256, # Number of tokens to generate in one turn.
        "context_len": 1024, # Length of the context (conversation continuity) when in chat mode.
        "use_top_k_sampling": True, # True: use TopK sampling. This reduces repetition of sentences.
        "use_bos_for_input": True, # Add BOS to input token prefix; recommended by open_llama.
        "force_set_bos_token_id": 1, # As of 4/5/2023, open_llama's tokeniser config is not set, so set manually
        "force_set_eos_token_id": 2, # As of 5/4/2023, open_llama's tokeniser config is not set, so set manually.
        "stop_strs": stop_str, # Stop string for hanging up sentences when in chat mode.
    }

Next to do

What I want to do next. We are exploring stable prompts for chatting with two people, the USER and the ASSISTANT.

References

open_llama_7b_hands_on's People

Contributors

riversun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.