GithubHelp home page GithubHelp logo

mpt-play's Introduction

MPT-Play

Type a message to begin the conversation…/$ Hey, my name is Reimu. I maintain the barrier to Gensokyo./Ah, the legendary Reimu. I'm sure your barrier is the most powerful in Gensokyo. That's a lot of responsibility for someone your age!/$ it's not that much really /Anyway, I was thinking that I might try to visit Gensokyo someday. Do you think it will be okay if I just show up one day?/$ Probably fine./But there could be consequences to my actions. I don't know exactly how the barrier works./$ The barrier only affects living things and their creations./I'm glad to hear that. I'll try to plan my visit carefully then.

Python script to demonstrate how to invoke models such as MPT-7B-Chat from the command-line.

Setup

All instructions are written assuming your command-line shell is bash.

Clone repository:

git clone https://github.com/Birch-san/mpt-play.git
cd mpt-play

Create + activate a new virtual environment

This is to avoid interfering with your current Python environment (other Python scripts on your computer might not appreciate it if you update a bunch of packages they were relying on).

Follow the instructions for virtualenv, or conda, or neither (if you don't care what happens to other Python scripts on your computer).

Using venv

Create environment:

. ./venv/bin/activate
pip install --upgrade pip

Activate environment:

. ./venv/bin/activate

(First-time) update environment's pip:

pip install --upgrade pip

Using conda

Download conda.

Skip this step if you already have conda.

Install conda:

Skip this step if you already have conda.

Assuming you're using a bash shell:

# Linux installs Anaconda via this shell script. Mac installs by running a .pkg installer.
bash Anaconda-latest-Linux-x86_64.sh
# this step probably works on both Linux and Mac.
eval "$(~/anaconda3/bin/conda shell.bash hook)"
conda config --set auto_activate_base false
conda init

Create environment:

conda create -n p311-mpt python=3.11

Activate environment:

conda activate p311-mpt

Install package dependencies

Ensure you have activated the environment you created above.

(Optional) treat yourself to latest nightly of PyTorch, with support for Python 3.11 and CUDA 12.1:

# CUDA
pip install --upgrade --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cu121
# Mac
pip install --upgrade --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu

Install dependencies:

pip install -r requirements.txt

Run:

From root of repository:

python -m scripts.chat_play --trust_remote_code --bf16

On Mac you'll need to disable bfloat16. PYTORCH_ENABLE_MPS_FALLBACK=1 is not necessary in current PyTorch nightly, but there's no harm keeping it (and it may help on older PyTorch):

PYTORCH_ENABLE_MPS_FALLBACK=1 python -m scripts.chat_play --trust_remote_code

License

This repository is itself MIT-licensed.

Includes MIT-licensed code copied from Artidoro Pagnoni's qlora, and Apache-licensed code copied from MosaicML's mpt-7b-chat Huggingface Space.

mpt-play's People

Contributors

birch-san avatar tmm1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mpt-play's Issues

q4

Fantastic! it works like a charm. Is it possible to use a q4_0 .bin ?

Memory usage growing (MacOS)

Thanks for this. Super fantastic.
I notice that memory usage continuously grows. It starts off around 25G -- almost the same as crawling along under 100% CPU -- but with each conversation turn memory increases & swapping ensues. I don't know if you're using the issue tracker here, but just in case I thought I'd mention it. I will look more closely tomorrow, but chances are someone has already beat me to it.

MacOS Ventura 13.4 on a M1 MacBook Pro with 32Gb. Python 3.10 and pytorch 2.1.0.dev20230526

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.