Skip to content

Commit

Permalink
Remove unnecessary shared.previous_model_name variable
Browse files Browse the repository at this point in the history
  • Loading branch information
oobabooga committed Jul 29, 2024
1 parent addcb52 commit 9dcff21
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/logits.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@


def get_next_logits(*args, **kwargs):
if shared.args.idle_timeout > 0 and shared.model is None and shared.previous_model_name not in [None, 'None']:
shared.model, shared.tokenizer = load_model(shared.previous_model_name)
if shared.args.idle_timeout > 0 and shared.model is None and shared.model_name not in [None, 'None']:
shared.model, shared.tokenizer = load_model(shared.model_name)

needs_lock = not args[2] # use_samplers
if needs_lock:
Expand Down
1 change: 0 additions & 1 deletion modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ def clear_torch_cache():

def unload_model(keep_model_name=False):
shared.model = shared.tokenizer = None
shared.previous_model_name = shared.model_name
shared.lora_names = []
shared.model_dirty_from_training = False
clear_torch_cache()
Expand Down
1 change: 0 additions & 1 deletion modules/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
model = None
tokenizer = None
model_name = 'None'
previous_model_name = 'None'
is_seq2seq = False
model_dirty_from_training = False
lora_names = []
Expand Down
4 changes: 2 additions & 2 deletions modules/text_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@


def generate_reply(*args, **kwargs):
if shared.args.idle_timeout > 0 and shared.model is None and shared.previous_model_name not in [None, 'None']:
shared.model, shared.tokenizer = load_model(shared.previous_model_name)
if shared.args.idle_timeout > 0 and shared.model is None and shared.model_name not in [None, 'None']:
shared.model, shared.tokenizer = load_model(shared.model_name)

shared.generation_lock.acquire()
try:
Expand Down

0 comments on commit 9dcff21

Please sign in to comment.