Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ if UseMemory:
|
|
40 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
41 |
)
|
42 |
|
43 |
-
|
44 |
dataset = load_dataset(str, split="train")
|
45 |
return dataset
|
46 |
|
@@ -68,7 +68,7 @@ mname = "facebook/blenderbot-400M-distill"
|
|
68 |
model = BlenderbotForConditionalGeneration.from_pretrained(mname)
|
69 |
tokenizer = BlenderbotTokenizer.from_pretrained(mname)
|
70 |
|
71 |
-
|
72 |
"""Filter the last 128 tokens"""
|
73 |
if inputs['input_ids'].shape[1] > 128:
|
74 |
inputs['input_ids'] = torch.tensor([inputs['input_ids'][0][-128:].tolist()])
|
@@ -87,7 +87,7 @@ title = "💬ChatBack🧠💾"
|
|
87 |
description = """Chatbot With persistent memory dataset allowing multiagent system AI to access a shared dataset as memory pool with stored interactions.
|
88 |
Current Best SOTA Chatbot: https://huggingface.co/facebook/blenderbot-400M-distill?text=Hey+my+name+is+ChatBack%21+Are+you+ready+to+rock%3F """
|
89 |
|
90 |
-
|
91 |
history = history or []
|
92 |
if history:
|
93 |
history_useful = ['</s> <s>'.join([str(a[0])+'</s> <s>'+str(a[1]) for a in history])]
|
|
|
40 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
41 |
)
|
42 |
|
43 |
+
def get_df(name: str):
|
44 |
dataset = load_dataset(str, split="train")
|
45 |
return dataset
|
46 |
|
|
|
68 |
model = BlenderbotForConditionalGeneration.from_pretrained(mname)
|
69 |
tokenizer = BlenderbotTokenizer.from_pretrained(mname)
|
70 |
|
71 |
+
def take_last_tokens(inputs, note_history, history):
|
72 |
"""Filter the last 128 tokens"""
|
73 |
if inputs['input_ids'].shape[1] > 128:
|
74 |
inputs['input_ids'] = torch.tensor([inputs['input_ids'][0][-128:].tolist()])
|
|
|
87 |
description = """Chatbot With persistent memory dataset allowing multiagent system AI to access a shared dataset as memory pool with stored interactions.
|
88 |
Current Best SOTA Chatbot: https://huggingface.co/facebook/blenderbot-400M-distill?text=Hey+my+name+is+ChatBack%21+Are+you+ready+to+rock%3F """
|
89 |
|
90 |
+
def chat(message, history):
|
91 |
history = history or []
|
92 |
if history:
|
93 |
history_useful = ['</s> <s>'.join([str(a[0])+'</s> <s>'+str(a[1]) for a in history])]
|