Update app_modules/utils.py
This commit is contained in:
parent
7edc905c10
commit
3d2cf1ed18
|
@ -13,6 +13,7 @@ import html
|
|||
import markdown2
|
||||
import torch
|
||||
import sys
|
||||
import gc
|
||||
from pygments.lexers import guess_lexer, ClassNotFound
|
||||
|
||||
import gradio as gr
|
||||
|
@ -282,6 +283,13 @@ def greedy_search(input_ids: torch.Tensor,
|
|||
|
||||
yield text
|
||||
if any([x in text for x in stop_words]):
|
||||
del past_key_values
|
||||
del logits
|
||||
del probs
|
||||
del probs_sort
|
||||
del probs_idx
|
||||
del probs_sum
|
||||
gc.collect()
|
||||
return
|
||||
|
||||
def generate_prompt_with_history(text,history,tokenizer,max_length=2048):
|
||||
|
|
Loading…
Reference in New Issue