Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,18 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline, T5Tokenizer, T5ForConditionalGeneration
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Load the pipeline with your model and tokenizer
|
8 |
qa_pipeline = pipeline(
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline, T5Tokenizer, T5ForConditionalGeneration
|
3 |
|
4 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
5 |
+
|
6 |
+
model_repo_path = 'nxmwxm/correct_answer'
|
7 |
+
|
8 |
+
# Load tokenizer and model
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained(model_repo_path)
|
10 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_repo_path)
|
11 |
+
|
12 |
+
# Check and add special tokens if needed
|
13 |
+
special_tokens_dict = {'additional_special_tokens': ['<extra_id_99>']}
|
14 |
+
num_added_toks = tokenizer.add_special_tokens(special_tokens_dict)
|
15 |
+
model.resize_token_embeddings(len(tokenizer))
|
16 |
|
17 |
# Load the pipeline with your model and tokenizer
|
18 |
qa_pipeline = pipeline(
|