diff --git a/Jupyter.bat b/Jupyter.bat index df19a07f..c00d250d 100644 --- a/Jupyter.bat +++ b/Jupyter.bat @@ -6,6 +6,13 @@ IF %M%==1 GOTO drivemap IF %M%==2 GOTO subfolder IF %M%==3 GOTO drivemap_B +:Isolation +call conda deactivate 2>NUL +set Path=%windir%\system32;%windir%;C:\Windows\System32\Wbem;%windir%\System32\WindowsPowerShell\v1.0\;%windir%\System32\OpenSSH\ +SET CONDA_SHLVL= +SET PYTHONNOUSERSITE=1 +SET PYTHONPATH= + :subfolder umamba.exe install --no-shortcuts -r miniconda3 -n base -c conda-forge jupyterlab jupyterlab-git call miniconda3\condabin\activate diff --git a/aiserver.py b/aiserver.py index 3c574431..08066349 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1390,9 +1390,7 @@ def general_startup(override_args=None): parser.add_argument("--summarizer_model", action='store', default="philschmid/bart-large-cnn-samsum", help="Huggingface model to use for summarization. Defaults to sshleifer/distilbart-cnn-12-6") parser.add_argument("--max_summary_length", action='store', default=75, help="Maximum size for summary to send to image generation") parser.add_argument("--multi_story", action='store_true', default=False, help="Allow multi-story mode (experimental)") - parser.add_argument("--peft", type=str, help="Specify the path or HuggingFace ID of a Peft to load it. Not supported on TPU. (Experimental)") - parser.add_argument("--trust_remote_code", action='store_true', default=False, help="Allow Huggingface Models to Execute Code (Insecure!)") - + parser.add_argument("--peft", type=str, help="Specify the path or HuggingFace ID of a Peft to load it. Not supported on TPU. (Experimental)") parser.add_argument('-f', action='store', help="option for compatability with colab memory profiles") parser.add_argument('-v', '--verbosity', action='count', default=0, help="The default logging level is ERROR or higher. This value increases the amount of logging seen in your screen") parser.add_argument('-q', '--quiesce', action='count', default=0, help="The default logging level is ERROR or higher. This value decreases the amount of logging seen in your screen") @@ -1474,7 +1472,6 @@ def general_startup(override_args=None): args.remote = True; args.override_rename = True; args.override_delete = True; - args.nobreakmodel = True; args.quiet = True; args.lowmem = True; args.noaimenu = True; @@ -1521,13 +1518,6 @@ def general_startup(override_args=None): allowed_ips = sorted(allowed_ips, key=lambda ip: int(''.join([i.zfill(3) for i in ip.split('.')]))) print(f"Allowed IPs: {allowed_ips}") - if args.trust_remote_code: - logger.warning("EXECUTION OF UNSAFE REMOTE CODE IS ENABLED!!!") - logger.warning("You are not protected from Model Viruses in this mode!") - logger.warning("Exit the program now to abort execution!") - logger.warning("Only use this mode with models that you trust and verified!") - time.sleep(25) - koboldai_vars.trust_remote_code = True if args.cpu: koboldai_vars.use_colab_tpu = False koboldai_vars.hascuda = False @@ -1682,7 +1672,6 @@ class RestrictedUnpickler(pickle.Unpickler): ) def load(self, *args, **kwargs): - logger.info("Using safe unpickle") self.original_persistent_load = getattr( self, "persistent_load", pickle.Unpickler.persistent_load ) diff --git a/commandline.bat b/commandline.bat index 5372a9a3..94e61608 100644 --- a/commandline.bat +++ b/commandline.bat @@ -2,6 +2,8 @@ cd /D %~dp0 :Isolation +call conda deactivate 2>NUL +set Path=%windir%\system32;%windir%;C:\Windows\System32\Wbem;%windir%\System32\WindowsPowerShell\v1.0\;%windir%\System32\OpenSSH\ SET CONDA_SHLVL= SET PYTHONNOUSERSITE=1 SET PYTHONPATH= diff --git a/install_git_transformers.bat b/install_git_transformers.bat index 8c6257cc..34194459 100644 --- a/install_git_transformers.bat +++ b/install_git_transformers.bat @@ -2,6 +2,8 @@ cd /D %~dp0 :Isolation +call conda deactivate 2>NUL +set Path=%windir%\system32;%windir%;C:\Windows\System32\Wbem;%windir%\System32\WindowsPowerShell\v1.0\;%windir%\System32\OpenSSH\ SET CONDA_SHLVL= SET PYTHONNOUSERSITE=1 SET PYTHONPATH= diff --git a/install_requirements.bat b/install_requirements.bat index 69e4a47a..9756a18f 100644 --- a/install_requirements.bat +++ b/install_requirements.bat @@ -10,6 +10,8 @@ Reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" cd /D %~dp0 :Isolation +call conda deactivate 2>NUL +set Path=%windir%\system32;%windir%;C:\Windows\System32\Wbem;%windir%\System32\WindowsPowerShell\v1.0\;%windir%\System32\OpenSSH\ SET CONDA_SHLVL= SET PYTHONNOUSERSITE=1 SET PYTHONPATH= diff --git a/koboldai_settings.py b/koboldai_settings.py index cd8fdafa..8ab134fa 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -1206,12 +1206,12 @@ class system_settings(settings): local_only_variables = ['lua_state', 'lua_logname', 'lua_koboldbridge', 'lua_kobold', 'lua_koboldcore', 'regex_sl', 'acregex_ai', 'acregex_ui', 'comregex_ai', 'comregex_ui', 'sp', '_horde_pid', 'inference_config', 'image_pipeline', - 'summarizer', 'summary_tokenizer', 'tts_model', 'rng_states', 'comregex_ai', 'comregex_ui', 'trust_remote_code'] + 'summarizer', 'summary_tokenizer', 'tts_model', 'rng_states', 'comregex_ai', 'comregex_ui'] no_save_variables = ['lua_state', 'lua_logname', 'lua_koboldbridge', 'lua_kobold', 'lua_koboldcore', 'sp', 'sp_length', '_horde_pid', 'horde_share', 'aibusy', 'serverstarted', 'inference_config', 'image_pipeline', 'summarizer', 'on_colab' 'summary_tokenizer', 'use_colab_tpu', 'noai', 'disable_set_aibusy', 'cloudflare_link', 'tts_model', - 'generating_image', 'bit_8_available', 'bit_4_available', 'host', 'hascuda', 'usegpu', 'rng_states', 'comregex_ai', 'comregex_ui', 'git_repository', 'git_branch', 'trust_remote_code'] + 'generating_image', 'bit_8_available', 'bit_4_available', 'host', 'hascuda', 'usegpu', 'rng_states', 'comregex_ai', 'comregex_ui', 'git_repository', 'git_branch'] settings_name = "system" def __init__(self, socketio, koboldai_var): self._socketio = socketio @@ -1304,7 +1304,6 @@ class system_settings(settings): self.seen_messages = [] self.git_repository = "" self.git_branch = "" - self.trust_remote_code = False @dataclass diff --git a/modeling/inference_models/generic_hf_torch/class.py b/modeling/inference_models/generic_hf_torch/class.py index 93bc08ea..a0b7b4cb 100644 --- a/modeling/inference_models/generic_hf_torch/class.py +++ b/modeling/inference_models/generic_hf_torch/class.py @@ -251,7 +251,7 @@ class model_backend(HFTorchInferenceModel): if utils.koboldai_vars.hascuda: - if self.usegpu: + if self.usegpu or self.nobreakmodel: # Use just VRAM self.model = self.model.half().to(utils.koboldai_vars.gpu_device) elif self.breakmodel: diff --git a/modeling/inference_models/horde/class.py b/modeling/inference_models/horde/class.py index f7da6604..3c19a0c1 100644 --- a/modeling/inference_models/horde/class.py +++ b/modeling/inference_models/horde/class.py @@ -41,7 +41,7 @@ class model_backend(InferenceModel): return model_name == "CLUSTER" or model_name in [x['value'] for x in self.models] def get_requested_parameters(self, model_name, model_path, menu_path, parameters = {}): - if os.path.exists("settings/api.model_backend.settings") and 'base_url' not in vars(self): + if os.path.exists("settings/horde.model_backend.settings") and 'base_url' not in vars(self): with open("settings/horde.model_backend.settings", "r") as f: temp = json.load(f) self.base_url = temp['url'] diff --git a/modeling/warpers.py b/modeling/warpers.py index ca7e7396..b8035023 100644 --- a/modeling/warpers.py +++ b/modeling/warpers.py @@ -42,10 +42,17 @@ import utils import torch import numpy as np -if utils.koboldai_vars.use_colab_tpu: - import jax - import jax.numpy as jnp - import tpu_mtj_backend +try: + ignore = utils.koboldai_vars.use_colab_tpu + ok = True +except: + ok = False + +if ok: + if utils.koboldai_vars.use_colab_tpu: + import jax + import jax.numpy as jnp + import tpu_mtj_backend def update_settings(): diff --git a/play.bat b/play.bat index 76261a37..c9e82b83 100644 --- a/play.bat +++ b/play.bat @@ -2,11 +2,13 @@ cd /D %~dp0 :Isolation +call conda deactivate 2>NUL +set Path=%windir%\system32;%windir%;C:\Windows\System32\Wbem;%windir%\System32\WindowsPowerShell\v1.0\;%windir%\System32\OpenSSH\ SET CONDA_SHLVL= SET PYTHONNOUSERSITE=1 SET PYTHONPATH= -rmdir /S /Q flask_session +rmdir /S /Q flask_session 2>NUL TITLE KoboldAI - Server SET /P M=NUL +set Path=%windir%\system32;%windir%;C:\Windows\System32\Wbem;%windir%\System32\WindowsPowerShell\v1.0\;%windir%\System32\OpenSSH\ SET CONDA_SHLVL= SET PYTHONNOUSERSITE=1 SET PYTHONPATH=