Spaces:
Runtime error
Runtime error
AstraBert
commited on
Commit
•
29180e9
1
Parent(s):
9628227
adding flan-t5-large
Browse files
utils.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from transformers import
|
2 |
import time
|
3 |
from langchain_community.llms import HuggingFacePipeline
|
4 |
from langchain.storage import LocalFileStore
|
@@ -11,8 +11,7 @@ from langchain.chains import ConversationalRetrievalChain
|
|
11 |
import os
|
12 |
from pypdf import PdfMerger
|
13 |
|
14 |
-
|
15 |
-
mod = "google/flan-t5-base"
|
16 |
tsk = "text2text-generation"
|
17 |
|
18 |
def merge_pdfs(pdfs: list):
|
@@ -129,13 +128,12 @@ def just_chatting(
|
|
129 |
|
130 |
|
131 |
try:
|
132 |
-
tokenizer =
|
133 |
mod,
|
134 |
)
|
135 |
|
136 |
-
tokenizer.pad_token = tokenizer.eos_token
|
137 |
|
138 |
-
model =
|
139 |
mod,
|
140 |
)
|
141 |
except Exception as e:
|
|
|
1 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration, pipeline
|
2 |
import time
|
3 |
from langchain_community.llms import HuggingFacePipeline
|
4 |
from langchain.storage import LocalFileStore
|
|
|
11 |
import os
|
12 |
from pypdf import PdfMerger
|
13 |
|
14 |
+
mod = "google/flan-t5-large"
|
|
|
15 |
tsk = "text2text-generation"
|
16 |
|
17 |
def merge_pdfs(pdfs: list):
|
|
|
128 |
|
129 |
|
130 |
try:
|
131 |
+
tokenizer = T5Tokenizer.from_pretrained(
|
132 |
mod,
|
133 |
)
|
134 |
|
|
|
135 |
|
136 |
+
model = T5ForConditionalGeneration.from_pretrained(
|
137 |
mod,
|
138 |
)
|
139 |
except Exception as e:
|