Merge branch 'UI2' of https://github.com/ebolam/KoboldAI into ui2-newsave

This commit is contained in:
somebody
2022-12-01 19:16:53 -06:00
7 changed files with 39 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import annotations
from dataclasses import dataclass
import importlib
import os, re, time, threading, json, pickle, base64, copy, tqdm, datetime, sys
import shutil
from typing import Union
@@ -1114,7 +1115,7 @@ class system_settings(settings):
'lua_koboldcore', 'sp', 'sp_length', '_horde_pid', 'horde_share', 'aibusy',
'serverstarted', 'inference_config', 'image_pipeline', 'summarizer',
'summary_tokenizer', 'use_colab_tpu', 'noai', 'disable_set_aibusy', 'cloudflare_link', 'tts_model',
'generating_image']
'generating_image', 'bit_8_available']
settings_name = "system"
def __init__(self, socketio, koboldai_var):
self.socketio = socketio
@@ -1198,6 +1199,18 @@ class system_settings(settings):
self.keep_img_gen_in_memory = False
self.cookies = {} #cookies for colab since colab's URL changes, cookies are lost
self.experimental_features = False
#check if bitsandbytes is installed
self.bit_8_available = False
if importlib.util.find_spec("bitsandbytes") is not None and sys.platform.startswith('linux'): #We can install bitsandbytes, but it doesn't work on windows, so limit it here
if torch.cuda.is_available():
for device in range(torch.cuda.device_count()):
if torch.cuda.get_device_properties(device).major > 7:
self.bit_8_available = True
break
elif torch.cuda.get_device_properties(device).major == 7 and torch.cuda.get_device_properties(device).minor >= 2:
self.bit_8_available = True
break
@dataclass
class _inference_config: