GithubHelp home page GithubHelp logo

sylvianhemus / text-generation-webui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oobabooga/text-generation-webui

0.0 1.0 0.0 319 KB

A gradio webui for running large language models locally. Supports gpt-j-6B, gpt-neox-20b, OPT, GALACTICA, and many others.

License: GNU Affero General Public License v3.0

Python 100.00%

text-generation-webui's Introduction

text-generation-webui

A gradio webui for running large language models locally. Supports gpt-j-6B, gpt-neox-20b, opt, galactica, and many others.

Its goal is to become the AUTOMATIC1111/stable-diffusion-webui of text generation.

webui screenshot

Features

  • Switch between different models using a dropdown menu.
  • Generate nice HTML output for gpt4chan.
  • Generate Markdown output for GALACTICA, including LaTeX support.
  • Notebook mode that resembles OpenAI's playground.
  • Chat mode for conversation and role playing.
  • Load 13b/20b models in 8-bit mode.
  • Load parameter presets from text files.

Installation

Create a conda environment:

conda create -n textgen
conda activate textgen

Install the appropriate pytorch for your GPU. For NVIDIA GPUs, this should work:

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

Install the requirements:

pip install -r requirements.txt

Downloading models

Models should be placed under models/model-name. For instance, models/gpt-j-6B for gpt-j-6B.

Hugging Face

Hugging Face is the main place to download models. These are some of my favorite:

The files that you need to download are the json, txt, and pytorch*.bin files. The remaining files are not necessary.

For your convenience, you can automatically download a model from HF using the script download-model.py. Its usage is very simple:

python download-model.py organization/model

For instance:

python download-model.py facebook/opt-1.3b

gpt4chan

gpt4chan has been shut down from Hugging Face, so you need to download it elsewhere. You have two options:

You also need to put GPT-J-6B's config.json file in the same folder: config.json

Converting to pytorch

The script convert-to-torch.py allows you to convert models to .pt format, which is about 10x faster to load:

python convert-to-torch.py models/model-name/

The output model will be saved to torch-dumps/model-name.pt. When you load a new model, the webui first looks for this .pt file; if it is not found, it loads the model as usual from models/model-name/.

Starting the webui

conda activate textgen
python server.py

Then browse to

http://localhost:7860/?__theme=dark

Optionally, you can use the following command-line flags:

--model model-name: Load this model by default.

--notebook: Launch the webui in notebook mode, where the output is written to the same text box as the input.

--chat: Launch the webui in chat mode.

Presets

Inference settings presets can be created under presets/ as text files. These files are detected automatically at startup.

Contributing

Pull requests are welcome.

text-generation-webui's People

Contributors

oobabooga avatar

Watchers

Sylvian Hemus 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.