mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-21 09:31:45 +00:00
upgraded documentation
This commit is contained in:
parent
bccd0c903b
commit
b676c29f58
@ -7,7 +7,7 @@ RUN python3 -m venv venv && . venv/bin/activate
|
|||||||
RUN python3 -m pip install --no-cache-dir -r requirements.txt --upgrade pip
|
RUN python3 -m pip install --no-cache-dir -r requirements.txt --upgrade pip
|
||||||
|
|
||||||
COPY ./app.py /srv/app.py
|
COPY ./app.py /srv/app.py
|
||||||
COPY ./pyGpt4All /srv/pyGpt4All
|
COPY ./gpt4all_api /srv/gpt4all_api
|
||||||
COPY ./backends /srv/backends
|
COPY ./backends /srv/backends
|
||||||
COPY ./static /srv/static
|
COPY ./static /srv/static
|
||||||
COPY ./templates /srv/templates
|
COPY ./templates /srv/templates
|
||||||
|
@ -97,9 +97,10 @@ Now you're ready to work!
|
|||||||
|
|
||||||
# Supported backends
|
# Supported backends
|
||||||
Two backends are now supported:
|
Two backends are now supported:
|
||||||
1 - [The llama_cpp backend](https://github.com/nomic-ai/pygpt4all)
|
1 - [The llama_cpp backend by Abdeladim](https://github.com/abdeladim-s/pyllamacpp)
|
||||||
2 - [The GPT-j backend](https://github.com/marella/gpt4all-j)
|
2 - [The GPT-j backend by Abdeladim](https://github.com/abdeladim-s/pygptj)
|
||||||
3 - Hugging face's Transformers (under construction)
|
3 - [The GPT-j backend by marella](https://github.com/marella/gpt4all-j)
|
||||||
|
4 - Hugging face's Transformers (under construction)
|
||||||
|
|
||||||
# Supported models
|
# Supported models
|
||||||
You can also refuse to download the model during the install procedure and download it manually.
|
You can also refuse to download the model during the install procedure and download it manually.
|
||||||
|
@ -35,9 +35,6 @@ class GPT4ALL(GPTBackend):
|
|||||||
model_path=f"./models/gpt_4all/{self.config['model']}",
|
model_path=f"./models/gpt_4all/{self.config['model']}",
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop_generation(self):
|
|
||||||
self.model._grab_text_callback()
|
|
||||||
|
|
||||||
def generate(self,
|
def generate(self,
|
||||||
prompt:str,
|
prompt:str,
|
||||||
n_predict: int = 128,
|
n_predict: int = 128,
|
||||||
|
@ -34,9 +34,6 @@ class GptJ(GPTBackend):
|
|||||||
prompt_context="", prompt_prefix="", prompt_suffix=""
|
prompt_context="", prompt_prefix="", prompt_suffix=""
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop_generation(self):
|
|
||||||
self.model._grab_text_callback()
|
|
||||||
|
|
||||||
def generate(self,
|
def generate(self,
|
||||||
prompt:str,
|
prompt:str,
|
||||||
n_predict: int = 128,
|
n_predict: int = 128,
|
||||||
|
@ -34,9 +34,6 @@ class GPTJ(GPTBackend):
|
|||||||
model=f"./models/llama_cpp/{self.config['model']}", avx2 = self.config["use_avx2"]
|
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,
|
def generate(self,
|
||||||
prompt:str,
|
prompt:str,
|
||||||
n_predict: int = 128,
|
n_predict: int = 128,
|
||||||
|
@ -11,7 +11,7 @@ from pathlib import Path
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
from transformers import AutoTokenizer, TextGenerationPipeline
|
from transformers import AutoTokenizer, TextGenerationPipeline
|
||||||
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
||||||
from pyGpt4All.backend import GPTBackend
|
from gpt4all_api.backend import GPTBackend
|
||||||
import torch
|
import torch
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -38,11 +38,6 @@ class GPTQ(GPTBackend):
|
|||||||
self.model = AutoGPTQForCausalLM.from_pretrained(self.model_dir, BaseQuantizeConfig())
|
self.model = AutoGPTQForCausalLM.from_pretrained(self.model_dir, BaseQuantizeConfig())
|
||||||
self.tokenizer = AutoTokenizer.from_pretrained(self.model_dir, use_fast=True )
|
self.tokenizer = AutoTokenizer.from_pretrained(self.model_dir, use_fast=True )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stop_generation(self):
|
|
||||||
self.model._grab_text_callback()
|
|
||||||
|
|
||||||
def generate(self,
|
def generate(self,
|
||||||
prompt:str,
|
prompt:str,
|
||||||
n_predict: int = 128,
|
n_predict: int = 128,
|
||||||
|
@ -13,7 +13,7 @@ from accelerate import init_empty_weights
|
|||||||
from accelerate import load_checkpoint_and_dispatch
|
from accelerate import load_checkpoint_and_dispatch
|
||||||
from transformers import AutoTokenizer
|
from transformers import AutoTokenizer
|
||||||
from transformers import AutoConfig, AutoModelForCausalLM
|
from transformers import AutoConfig, AutoModelForCausalLM
|
||||||
from pyGpt4All.backend import GPTBackend
|
from gpt4all_api.backend import GPTBackend
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
__author__ = "parisneo"
|
__author__ = "parisneo"
|
||||||
@ -39,10 +39,6 @@ class HuggingFace(GPTBackend):
|
|||||||
self.tokenizer = AutoTokenizer.from_pretrained(config["model"])
|
self.tokenizer = AutoTokenizer.from_pretrained(config["model"])
|
||||||
self.model = AutoModelForCausalLM.from_pretrained(config["model"], load_in_8bit=True, device_map='auto')
|
self.model = AutoModelForCausalLM.from_pretrained(config["model"], load_in_8bit=True, device_map='auto')
|
||||||
|
|
||||||
|
|
||||||
def stop_generation(self):
|
|
||||||
self.model._grab_text_callback()
|
|
||||||
|
|
||||||
def generate(self,
|
def generate(self,
|
||||||
prompt:str,
|
prompt:str,
|
||||||
n_predict: int = 128,
|
n_predict: int = 128,
|
||||||
|
@ -37,9 +37,6 @@ class LLAMACPP(GPTBackend):
|
|||||||
seed=self.config['seed'],
|
seed=self.config['seed'],
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop_generation(self):
|
|
||||||
self.model._grab_text_callback()
|
|
||||||
|
|
||||||
def generate(self,
|
def generate(self,
|
||||||
prompt:str,
|
prompt:str,
|
||||||
n_predict: int = 128,
|
n_predict: int = 128,
|
||||||
|
@ -167,34 +167,39 @@ class ModelProcess:
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print(ex)
|
print(ex)
|
||||||
def _generate(self, prompt, id, n_predict):
|
def _generate(self, prompt, id, n_predict):
|
||||||
self.id = id
|
if self.model is not None:
|
||||||
if self.config["override_personality_model_parameters"]:
|
self.id = id
|
||||||
self.model.generate(
|
if self.config["override_personality_model_parameters"]:
|
||||||
prompt,
|
self.model.generate(
|
||||||
new_text_callback=self._callback,
|
prompt,
|
||||||
n_predict=n_predict,
|
new_text_callback=self._callback,
|
||||||
temp=self.config['temperature'],
|
n_predict=n_predict,
|
||||||
top_k=self.config['top_k'],
|
temp=self.config['temperature'],
|
||||||
top_p=self.config['top_p'],
|
top_k=self.config['top_k'],
|
||||||
repeat_penalty=self.config['repeat_penalty'],
|
top_p=self.config['top_p'],
|
||||||
repeat_last_n = self.config['repeat_last_n'],
|
repeat_penalty=self.config['repeat_penalty'],
|
||||||
seed=self.config['seed'],
|
repeat_last_n = self.config['repeat_last_n'],
|
||||||
n_threads=self.config['n_threads']
|
seed=self.config['seed'],
|
||||||
)
|
n_threads=self.config['n_threads']
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.model.generate(
|
||||||
|
prompt,
|
||||||
|
new_text_callback=self._callback,
|
||||||
|
n_predict=n_predict,
|
||||||
|
temp=self.personality.model_temperature,
|
||||||
|
top_k=self.personality.model_top_k,
|
||||||
|
top_p=self.personality.model_top_p,
|
||||||
|
repeat_penalty=self.personality.model_repeat_penalty,
|
||||||
|
repeat_last_n = self.personality.model_repeat_last_n,
|
||||||
|
#seed=self.config['seed'],
|
||||||
|
n_threads=self.config['n_threads']
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.model.generate(
|
print("No model is installed or selected. Please make sure to install a model and select it inside your configuration before attempting to communicate with the model.")
|
||||||
prompt,
|
print("To do this: Install the model to your models/<backend name> folder.")
|
||||||
new_text_callback=self._callback,
|
print("Then set your model information in your local configuration file that you can find in configs/local_default.yaml")
|
||||||
n_predict=n_predict,
|
print("You can also use the ui to set your model in the settings page.")
|
||||||
temp=self.personality.model_temperature,
|
|
||||||
top_k=self.personality.model_top_k,
|
|
||||||
top_p=self.personality.model_top_p,
|
|
||||||
repeat_penalty=self.personality.model_repeat_penalty,
|
|
||||||
repeat_last_n = self.personality.model_repeat_last_n,
|
|
||||||
#seed=self.config['seed'],
|
|
||||||
n_threads=self.config['n_threads']
|
|
||||||
)
|
|
||||||
|
|
||||||
def _callback(self, text):
|
def _callback(self, text):
|
||||||
if not self.ready:
|
if not self.ready:
|
||||||
print(".",end="")
|
print(".",end="")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user