willsh1997 commited on
Commit
1761d59
·
1 Parent(s): 4270701

:wastebasket: cleaning unnecessary code

Browse files
Files changed (1) hide show
  1. context_window_gradio.py +0 -5
context_window_gradio.py CHANGED
@@ -44,7 +44,6 @@ def context_window_limiting(history: list[dict], context_window: int):
44
  # print(len(llama32_1b_pipe.tokenizer.apply_chat_template(history_windowed)))
45
  while len(llama32_1b_pipe.tokenizer.apply_chat_template(history_windowed)) >= context_window:
46
  if len(history_windowed) <= 0: #has to be a non-empty list
47
- print("Not deleting anything I guess fuck me")
48
  break
49
  else:
50
  del history_windowed[0] #delete first message
@@ -72,10 +71,6 @@ def llama32_1b_chat(message, history, context_window) -> str:
72
  def create_interface():
73
 
74
  with gr.Blocks() as demo:
75
- gr.Markdown("""DRAFT!: change context window lmao.
76
- NOTE: the strategy being used to generate outputs based on the simulated context window is to simply delete entire messages from earlier in the conversation until the input fits within the context window. There are several more sophisticated ways in which long chat histories can be dealt with (e.g. summarising the history, deleting messages but keeping keywords/concepts, other clever things), but this is the simplest, and potentially most illustrative of the shortcomings of having a limited context window.
77
-
78
- """)
79
  with gr.Row():
80
  context_window = gr.Slider(64, 1024, value=256, label="size of context window", info="choose context window size")
81
  with gr.Row():
 
44
  # print(len(llama32_1b_pipe.tokenizer.apply_chat_template(history_windowed)))
45
  while len(llama32_1b_pipe.tokenizer.apply_chat_template(history_windowed)) >= context_window:
46
  if len(history_windowed) <= 0: #has to be a non-empty list
 
47
  break
48
  else:
49
  del history_windowed[0] #delete first message
 
71
  def create_interface():
72
 
73
  with gr.Blocks() as demo:
 
 
 
 
74
  with gr.Row():
75
  context_window = gr.Slider(64, 1024, value=256, label="size of context window", info="choose context window size")
76
  with gr.Row():