mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-22 13:52:21 +00:00
added models
This commit is contained in:
parent
8ee1aaffd0
commit
f080437b13
82
backends/gptj/__init__.py
Normal file
82
backends/gptj/__init__.py
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
######
|
||||||
|
# Project : GPT4ALL-UI
|
||||||
|
# File : backend.py
|
||||||
|
# Author : ParisNeo with the help of the community
|
||||||
|
# Supported by Nomic-AI
|
||||||
|
# Licence : Apache 2.0
|
||||||
|
# Description :
|
||||||
|
# This is an interface class for GPT4All-ui backends.
|
||||||
|
######
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Callable
|
||||||
|
from gpt4allj import Model
|
||||||
|
from pyGpt4All.backend import GPTBackend
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
__author__ = "parisneo"
|
||||||
|
__github__ = "https://github.com/nomic-ai/gpt4all-ui"
|
||||||
|
__copyright__ = "Copyright 2023, "
|
||||||
|
__license__ = "Apache 2.0"
|
||||||
|
|
||||||
|
backend_name = "GPTJ"
|
||||||
|
|
||||||
|
class GPTJ(GPTBackend):
|
||||||
|
file_extension='*.bin'
|
||||||
|
def __init__(self, config:dict) -> None:
|
||||||
|
"""Builds a LLAMACPP backend
|
||||||
|
|
||||||
|
Args:
|
||||||
|
config (dict): The configuration file
|
||||||
|
"""
|
||||||
|
super().__init__(config, False)
|
||||||
|
|
||||||
|
self.model = Model(
|
||||||
|
model=f"./models/llama_cpp/{self.config['model']}", avx2 = self.config["use_avx2"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def stop_generation(self):
|
||||||
|
self.model._grab_text_callback()
|
||||||
|
|
||||||
|
def generate(self,
|
||||||
|
prompt:str,
|
||||||
|
n_predict: int = 128,
|
||||||
|
new_text_callback: Callable[[str], None] = bool,
|
||||||
|
verbose: bool = False,
|
||||||
|
**gpt_params ):
|
||||||
|
"""Generates text out of a prompt
|
||||||
|
|
||||||
|
Args:
|
||||||
|
prompt (str): The prompt to use for generation
|
||||||
|
n_predict (int, optional): Number of tokens to prodict. Defaults to 128.
|
||||||
|
new_text_callback (Callable[[str], None], optional): A callback function that is called everytime a new text element is generated. Defaults to None.
|
||||||
|
verbose (bool, optional): If true, the code will spit many informations about the generation process. Defaults to False.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
self.model.reset()
|
||||||
|
for tok in self.model.generate(
|
||||||
|
prompt,
|
||||||
|
seed=self.config['seed'],
|
||||||
|
n_threads=self.config['n_threads'],
|
||||||
|
n_predict=n_predict,
|
||||||
|
top_k=self.config['top_k'],
|
||||||
|
top_p=self.config['top_p'],
|
||||||
|
temp=self.config['temperature'],
|
||||||
|
repeat_penalty=self.config['repeat_penalty'],
|
||||||
|
repeat_last_n=self.config['repeat_last_n'],
|
||||||
|
n_batch=8,
|
||||||
|
reset=True,
|
||||||
|
):
|
||||||
|
if not new_text_callback(tok):
|
||||||
|
return
|
||||||
|
except Exception as ex:
|
||||||
|
print(ex)
|
||||||
|
@staticmethod
|
||||||
|
def get_available_models():
|
||||||
|
# Create the file path relative to the child class's directory
|
||||||
|
backend_path = Path(__file__).parent
|
||||||
|
file_path = backend_path/"models.yaml"
|
||||||
|
|
||||||
|
with open(file_path, 'r') as file:
|
||||||
|
yaml_data = yaml.safe_load(file)
|
||||||
|
|
||||||
|
return yaml_data
|
72
backends/gptj/models.yaml
Normal file
72
backends/gptj/models.yaml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
- bestGPTJ: 'true'
|
||||||
|
description: Current best commercially licensable model based on GPT-J and trained
|
||||||
|
by Nomic AI on the latest curated GPT4All dataset.
|
||||||
|
filename: ggml-gpt4all-j-v1.3-groovy.bin
|
||||||
|
filesize: '3785248281'
|
||||||
|
isDefault: 'true'
|
||||||
|
md5sum: 81a09a0ddf89690372fc296ff7f625af
|
||||||
|
- bestLlama: 'true'
|
||||||
|
description: Current best non-commercially licensable model based on Llama 13b and
|
||||||
|
trained by Nomic AI on the latest curated GPT4All dataset.
|
||||||
|
filename: ggml-gpt4all-l13b-snoozy.bin
|
||||||
|
filesize: '8136770688'
|
||||||
|
md5sum: 91f886b68fbce697e9a3cd501951e455
|
||||||
|
- bestMPT: 'true'
|
||||||
|
description: Current best non-commercially licensable chat model based on MPT and
|
||||||
|
trained by Mosaic ML.
|
||||||
|
filename: ggml-mpt-7b-chat.bin
|
||||||
|
filesize: '4854401050'
|
||||||
|
isDefault: 'true'
|
||||||
|
md5sum: 756249d3d6abe23bde3b1ae272628640
|
||||||
|
requires: 2.4.1
|
||||||
|
- description: A commercially licensable model based on GPT-J and trained by Nomic
|
||||||
|
AI on the v2 GPT4All dataset.
|
||||||
|
filename: ggml-gpt4all-j-v1.2-jazzy.bin
|
||||||
|
filesize: '3785248281'
|
||||||
|
md5sum: 879344aaa9d62fdccbda0be7a09e7976
|
||||||
|
- description: A commercially licensable model based on GPT-J and trained by Nomic
|
||||||
|
AI on the v1 GPT4All dataset.
|
||||||
|
filename: ggml-gpt4all-j-v1.1-breezy.bin
|
||||||
|
filesize: '3785248281'
|
||||||
|
md5sum: 61d48a82cb188cceb14ebb8082bfec37
|
||||||
|
- description: A commercially licensable model based on GPT-J and trained by Nomic
|
||||||
|
AI on the v0 GPT4All dataset.
|
||||||
|
filename: ggml-gpt4all-j.bin
|
||||||
|
filesize: '3785248281'
|
||||||
|
md5sum: 5b5a3f9b858d33b29b52b89692415595
|
||||||
|
- description: A non-commercially licensable model based on Llama 7b and trained by
|
||||||
|
teams from UC Berkeley, CMU, Stanford, MBZUAI, and UC San Diego.
|
||||||
|
filename: ggml-vicuna-7b-1.1-q4_2.bin
|
||||||
|
filesize: '4212859520'
|
||||||
|
md5sum: 29119f8fa11712704c6b22ac5ab792ea
|
||||||
|
- description: A non-commercially licensable model based on Llama 13b and trained
|
||||||
|
by teams from UC Berkeley, CMU, Stanford, MBZUAI, and UC San Diego.
|
||||||
|
filename: ggml-vicuna-13b-1.1-q4_2.bin
|
||||||
|
filesize: '8136770688'
|
||||||
|
md5sum: 95999b7b0699e2070af63bf5d34101a8
|
||||||
|
- description: A non-commercially licensable model based on Llama 7b and trained by
|
||||||
|
Microsoft and Peking University.
|
||||||
|
filename: ggml-wizardLM-7B.q4_2.bin
|
||||||
|
filesize: '4212864640'
|
||||||
|
md5sum: 99e6d129745a3f1fb1121abed747b05a
|
||||||
|
- description: A non-commercially licensable model based on Llama 13b and RLHF trained
|
||||||
|
by Stable AI.
|
||||||
|
filename: ggml-stable-vicuna-13B.q4_2.bin
|
||||||
|
filesize: '8136777088'
|
||||||
|
md5sum: 6cb4ee297537c9133bddab9692879de0
|
||||||
|
- description: A commercially licensable model base pre-trained by Mosaic ML.
|
||||||
|
filename: ggml-mpt-7b-base.bin
|
||||||
|
filesize: '4854401028'
|
||||||
|
md5sum: 120c32a51d020066288df045ef5d52b9
|
||||||
|
requires: 2.4.1
|
||||||
|
- description: A non-commercially licensable model based on Vicuna 13b, fine-tuned
|
||||||
|
on ~180,000 instructions, trained by Nous Research.
|
||||||
|
filename: ggml-nous-gpt4-vicuna-13b.bin
|
||||||
|
filesize: '8136777088'
|
||||||
|
md5sum: d5eafd5b0bd0d615cfd5fd763f642dfe
|
||||||
|
- description: A commericially licensable instruct model based on MPT and trained
|
||||||
|
by Mosaic ML.
|
||||||
|
filename: ggml-mpt-7b-instruct.bin
|
||||||
|
filesize: '4854401028'
|
||||||
|
md5sum: 1cfa4958f489f0a0d1ffdf6b37322809
|
||||||
|
requires: 2.4.1
|
Loading…
Reference in New Issue
Block a user