This commit is contained in:
ebolam
2022-08-15 17:59:34 -04:00
parent 47f210a240
commit 2ab89232bc
2 changed files with 9 additions and 3 deletions

View File

@@ -1095,7 +1095,10 @@ def get_layer_count(model, directory=""):
else:
from transformers import AutoConfig
if directory == "":
model_config = AutoConfig.from_pretrained(model, cache_dir="cache")
if os.path.isdir("./models/{}".format(model.replace("/", "_"))):
model_config = AutoConfig.from_pretrained("./models/{}".format(model.replace("/", "_")), cache_dir="cache")
else:
model_config = AutoConfig.from_pretrained(model, cache_dir="cache")
elif os.path.isdir(directory):
model_config = AutoConfig.from_pretrained(directory, cache_dir="cache")
else:

View File

@@ -121,7 +121,7 @@ class koboldai_vars(object):
def calc_ai_text(self):
token_budget = self.max_length
used_world_info = []
used_tokens = 0
used_tokens = self.sp_length
text = ""
self.worldinfo_v2.reset_used_in_game()
@@ -845,7 +845,10 @@ class KoboldStoryRegister(object):
self.set_game_saved()
def set_action_in_ai(self, action_id, used=True):
old = self.actions[action_id]['In AI Input']
if 'In AI Input' in self.actions[action_id]:
old = self.actions[action_id]['In AI Input']
else:
old = None
self.actions[action_id]['In AI Input'] = used
if old != used:
process_variable_changes(self.socketio, "actions", 'In AI Input', {"id": action_id, 'In AI Input': self.actions[action_id]["In AI Input"]}, None)