Skip to content

Commit ba85271

Browse files
authored
Merge pull request #5574 from oobabooga/dev
Merge dev branch
2 parents d6bb6e7 + d341262 commit ba85271

22 files changed

Lines changed: 144 additions & 116 deletions

css/main.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,11 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
717717
width: calc((100vw - 880px - 120px) /2);
718718
}
719719

720+
.pfp_character {
721+
position: relative;
722+
z-index: 100;
723+
}
724+
720725
.pfp_character:hover {
721726
cursor: pointer;
722727
}

extensions/ngrok/script.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# See this example for full list of options: https://github.com/ngrok/ngrok-py/blob/main/examples/ngrok-connect-full.py
99
# or the README.md in this directory.
1010

11-
import logging
1211
from modules import shared
1312

1413
# Pick up host/port command line arguments
@@ -31,6 +30,6 @@ def ui():
3130
try:
3231
import ngrok
3332
tunnel = ngrok.connect(**options)
34-
logging.info(f"Ingress established at: {tunnel.url()}")
33+
shared.logger.info(f"Ingress established at: {tunnel.url()}")
3534
except ModuleNotFoundError:
36-
logging.error("===> ngrok library not found, please run `pip install -r extensions/ngrok/requirements.txt`")
35+
shared.logger.error("===> ngrok library not found, please run `pip install -r extensions/ngrok/requirements.txt`")

js/main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ function addBigPicture() {
354354
var timestamp = new Date().getTime();
355355
imgElement.src = "/file/cache/pfp_character.png?time=" + timestamp;
356356
imgElement.classList.add("bigProfilePicture");
357+
imgElement.addEventListener("load", function () {
358+
this.style.visibility = "visible";
359+
});
360+
imgElement.addEventListener("error", function () {
361+
this.style.visibility = "hidden";
362+
});
357363

358364
var imgElementParent = document.getElementById("chat").parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
359365
imgElementParent.appendChild(imgElement);

modules/chat.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,11 @@ def rename_history(old_id, new_id, character, mode):
501501
old_p = get_history_file_path(old_id, character, mode)
502502
new_p = get_history_file_path(new_id, character, mode)
503503
if new_p.parent != old_p.parent:
504-
logger.error(f"The following path is not allowed: {new_p}.")
504+
logger.error(f"The following path is not allowed: \"{new_p}\".")
505505
elif new_p == old_p:
506506
logger.info("The provided path is identical to the old one.")
507507
else:
508-
logger.info(f"Renaming {old_p} to {new_p}")
508+
logger.info(f"Renaming \"{old_p}\" to \"{new_p}\"")
509509
old_p.rename(new_p)
510510

511511

@@ -522,12 +522,13 @@ def find_all_histories(state):
522522
old_p = Path(f'logs/{character}_persistent.json')
523523
new_p = Path(f'logs/persistent_{character}.json')
524524
if old_p.exists():
525-
logger.warning(f"Renaming {old_p} to {new_p}")
525+
logger.warning(f"Renaming \"{old_p}\" to \"{new_p}\"")
526526
old_p.rename(new_p)
527+
527528
if new_p.exists():
528529
unique_id = datetime.now().strftime('%Y%m%d-%H-%M-%S')
529530
p = get_history_file_path(unique_id, character, state['mode'])
530-
logger.warning(f"Moving {new_p} to {p}")
531+
logger.warning(f"Moving \"{new_p}\" to \"{p}\"")
531532
p.parent.mkdir(exist_ok=True)
532533
new_p.rename(p)
533534

modules/evaluate.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,20 @@ def calculate_perplexity(models, input_dataset, stride, _max_length):
3939
https://huggingface.co/docs/transformers/perplexity#calculating-ppl-with-fixedlength-models
4040
'''
4141

42+
if shared.args.loader == "llama.cpp":
43+
logger.error("llamacpp_HF is required for perplexity evaluation with GGUF models. Please reload the model with llamacpp_HF instead of llama.cpp.")
44+
raise ValueError
45+
46+
if shared.args.loader == "ExLlamav2":
47+
logger.error("ExLlamav2_HF is required for perplexity evaluation with EXL2 models. Please reload the model with ExLlamav2_HF instead of ExLlamav2.")
48+
raise ValueError
49+
50+
if shared.args.loader == "llamacpp_HF" and not shared.args.logits_all:
51+
logger.error("--logits_all is required for perplexity evaluation with GGUF models. Please reload the model with that option set/checked.")
52+
raise ValueError
53+
4254
if not shared.args.no_use_fast:
43-
logger.warning("--no_use_fast is not being used. If tokenizing the input dataset takes a long time, consider loading the model with that option checked.")
55+
logger.warning("--no_use_fast is not set. If tokenizing the input dataset takes a long time, try reloading the model with that option set/checked.")
4456

4557
global past_evaluations
4658
cumulative_log = ''

modules/extensions.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import importlib
12
import traceback
23
from functools import partial
34
from inspect import signature
@@ -33,13 +34,11 @@ def load_extensions():
3334
logger.info(f'Loading the extension "{name}"')
3435
try:
3536
try:
36-
exec(f"import extensions.{name}.script")
37+
extension = importlib.import_module(f"extensions.{name}.script")
3738
except ModuleNotFoundError:
3839
logger.error(f"Could not import the requirements for '{name}'. Make sure to install the requirements for the extension.\n\nLinux / Mac:\n\npip install -r extensions/{name}/requirements.txt --upgrade\n\nWindows:\n\npip install -r extensions\\{name}\\requirements.txt --upgrade\n\nIf you used the one-click installer, paste the command above in the terminal window opened after launching the cmd script for your OS.")
3940
raise
4041

41-
extension = getattr(extensions, name).script
42-
4342
# Only run setup() and apply settings from settings.yaml once
4443
if extension not in setup_called:
4544
apply_settings(extension, name)

modules/llamacpp_hf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, model, path):
4848
'n_tokens': self.model.n_tokens,
4949
'input_ids': self.model.input_ids,
5050
'scores': self.model.scores,
51-
'ctx': self.model._ctx
51+
'ctx': self.model._ctx.ctx
5252
}
5353

5454
if shared.args.cfg_cache:
@@ -74,28 +74,28 @@ def save_cache(self):
7474
'n_tokens': self.model.n_tokens,
7575
'input_ids': self.model.input_ids,
7676
'scores': self.model.scores,
77-
'ctx': self.model._ctx
77+
'ctx': self.model._ctx.ctx
7878
})
7979

8080
def save_negative_cache(self):
8181
self.llamacpp_cache_negative.update({
8282
'n_tokens': self.model.n_tokens,
8383
'input_ids': self.model.input_ids,
8484
'scores': self.model.scores,
85-
'ctx': self.model._ctx
85+
'ctx': self.model._ctx.ctx
8686
})
8787

8888
def load_cache(self):
8989
self.model.n_tokens = self.llamacpp_cache['n_tokens']
9090
self.model.input_ids = self.llamacpp_cache['input_ids']
9191
self.model.scores = self.llamacpp_cache['scores']
92-
self.model._ctx = self.llamacpp_cache['ctx']
92+
self.model._ctx.ctx = self.llamacpp_cache['ctx']
9393

9494
def load_negative_cache(self):
9595
self.model.n_tokens = self.llamacpp_cache_negative['n_tokens']
9696
self.model.input_ids = self.llamacpp_cache_negative['input_ids']
9797
self.model.scores = self.llamacpp_cache_negative['scores']
98-
self.model._ctx = self.llamacpp_cache_negative['ctx']
98+
self.model._ctx.ctx = self.llamacpp_cache_negative['ctx']
9999

100100
@property
101101
def device(self) -> torch.device:

modules/training.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,13 @@ def create_ui():
192192
# doesn't work with the .then() syntax, so I write them one
193193
# by one in this ugly but functional way.
194194
ev = start_evaluation.click(calculate_perplexity, [models, evaluate_text_file, stride_length, max_length], evaluation_log, show_progress=False)
195-
start_evaluation.click(generate_markdown_table, None, evaluation_table, show_progress=False)
195+
ev.then(generate_markdown_table, None, evaluation_table, show_progress=False)
196196

197-
start_current_evaluation.click(lambda: ['current model'], None, tmp)
198-
ev_cur = start_current_evaluation.click(calculate_perplexity, [tmp, evaluate_text_file, stride_length, max_length], evaluation_log, show_progress=False)
199-
start_current_evaluation.click(generate_markdown_table, None, evaluation_table, show_progress=False)
197+
ev_cur = start_current_evaluation.click(
198+
lambda: ['current model'], None, tmp).then(
199+
calculate_perplexity, [tmp, evaluate_text_file, stride_length, max_length], evaluation_log, show_progress=False)
200+
201+
ev_cur.then(generate_markdown_table, None, evaluation_table, show_progress=False)
200202

201203
stop_evaluation.click(None, None, None, cancels=[ev, ev_cur], queue=False)
202204
refresh_table.click(generate_markdown_table, None, evaluation_table, show_progress=True)

requirements.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
accelerate==0.25.*
1+
accelerate==0.27.*
22
colorama
33
datasets
44
einops
@@ -8,7 +8,7 @@ jinja2==3.1.2
88
lm_eval==0.3.0
99
markdown
1010
numpy==1.26.*
11-
optimum==1.16.*
11+
optimum==1.17.*
1212
pandas
1313
peft==0.8.*
1414
Pillow>=9.5.0
@@ -28,33 +28,33 @@ bitsandbytes==0.42.*; platform_system != "Windows"
2828
https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl; platform_system == "Windows"
2929

3030
# llama-cpp-python (CPU only, AVX2)
31-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.44+cpuavx2-cp311-cp311-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
32-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.44+cpuavx2-cp310-cp310-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
33-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.44+cpuavx2-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
34-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.44+cpuavx2-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
31+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.50+cpuavx2-cp311-cp311-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
32+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.50+cpuavx2-cp310-cp310-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
33+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.50+cpuavx2-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
34+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/cpu/llama_cpp_python-0.2.50+cpuavx2-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
3535

3636
# llama-cpp-python (CUDA, no tensor cores)
37-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.44+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
38-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.44+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
39-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.44+cu121-cp311-cp311-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
40-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.44+cu121-cp310-cp310-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
37+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.50+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
38+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.50+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
39+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.50+cu121-cp311-cp311-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
40+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.50+cu121-cp310-cp310-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
4141

4242
# llama-cpp-python (CUDA, tensor cores)
43-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.44+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
44-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.44+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
45-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.44+cu121-cp311-cp311-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
46-
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.44+cu121-cp310-cp310-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
43+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.50+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
44+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.50+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
45+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.50+cu121-cp311-cp311-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
46+
https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda_tensorcores-0.2.50+cu121-cp310-cp310-manylinux_2_31_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
4747

4848
# CUDA wheels
4949
https://github.com/jllllll/AutoGPTQ/releases/download/v0.6.0/auto_gptq-0.6.0+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
5050
https://github.com/jllllll/AutoGPTQ/releases/download/v0.6.0/auto_gptq-0.6.0+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
5151
https://github.com/jllllll/AutoGPTQ/releases/download/v0.6.0/auto_gptq-0.6.0+cu121-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
5252
https://github.com/jllllll/AutoGPTQ/releases/download/v0.6.0/auto_gptq-0.6.0+cu121-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
53-
https://github.com/oobabooga/exllamav2/releases/download/v0.0.13.2/exllamav2-0.0.13.2+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
54-
https://github.com/oobabooga/exllamav2/releases/download/v0.0.13.2/exllamav2-0.0.13.2+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
55-
https://github.com/oobabooga/exllamav2/releases/download/v0.0.13.2/exllamav2-0.0.13.2+cu121-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
56-
https://github.com/oobabooga/exllamav2/releases/download/v0.0.13.2/exllamav2-0.0.13.2+cu121-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
57-
https://github.com/oobabooga/exllamav2/releases/download/v0.0.13.2/exllamav2-0.0.13.2-py3-none-any.whl; platform_system == "Linux" and platform_machine != "x86_64"
53+
https://github.com/oobabooga/exllamav2/releases/download/v0.0.14/exllamav2-0.0.14+cu121-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
54+
https://github.com/oobabooga/exllamav2/releases/download/v0.0.14/exllamav2-0.0.14+cu121-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
55+
https://github.com/oobabooga/exllamav2/releases/download/v0.0.14/exllamav2-0.0.14+cu121-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
56+
https://github.com/oobabooga/exllamav2/releases/download/v0.0.14/exllamav2-0.0.14+cu121-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
57+
https://github.com/oobabooga/exllamav2/releases/download/v0.0.14/exllamav2-0.0.14-py3-none-any.whl; platform_system == "Linux" and platform_machine != "x86_64"
5858
https://github.com/jllllll/flash-attention/releases/download/v2.3.4/flash_attn-2.3.4+cu121torch2.1cxx11abiFALSE-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
5959
https://github.com/jllllll/flash-attention/releases/download/v2.3.4/flash_attn-2.3.4+cu121torch2.1cxx11abiFALSE-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
6060
https://github.com/Dao-AILab/flash-attention/releases/download/v2.3.4/flash_attn-2.3.4+cu122torch2.1cxx11abiFALSE-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"

0 commit comments

Comments
 (0)