Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,14 @@ from langchain.prompts import PromptTemplate
|
|
9 |
from langchain.llms import HuggingFaceHub
|
10 |
from langchain.chains import LLMChain
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
####
|
13 |
## Sentinent models
|
14 |
# https://huggingface.co/spaces/CK42/sentiment-model-comparison
|
@@ -26,12 +34,17 @@ model_id_6 = "sbcBI/sentiment_analysis_model"
|
|
26 |
# https://huggingface.co/spaces/CK42/sentiment-model-comparison
|
27 |
# 1 seem best for testing
|
28 |
####
|
29 |
-
#
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
# https://colab.research.google.com/drive/1hrS6_g14EcOD4ezwSGlGX2zxJegX5uNX#scrollTo=NUwUR9U7qkld
|
33 |
llm_hf = HuggingFaceHub(
|
34 |
-
repo_id=
|
35 |
model_kwargs={"temperature":0.9 }
|
36 |
)
|
37 |
|
|
|
9 |
from langchain.llms import HuggingFaceHub
|
10 |
from langchain.chains import LLMChain
|
11 |
|
12 |
+
#import model class and tokenizer
|
13 |
+
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
|
14 |
+
|
15 |
+
#import model class and tokenizer
|
16 |
+
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
####
|
21 |
## Sentinent models
|
22 |
# https://huggingface.co/spaces/CK42/sentiment-model-comparison
|
|
|
34 |
# https://huggingface.co/spaces/CK42/sentiment-model-comparison
|
35 |
# 1 seem best for testing
|
36 |
####
|
37 |
+
#download and setup the model and tokenizer
|
38 |
+
model_name = 'facebook/blenderbot-400M-distill'
|
39 |
+
tokenizer = BlenderbotTokenizer.from_pretrained(model_name)
|
40 |
+
model = BlenderbotForConditionalGeneration.from_pretrained(model_name)
|
41 |
+
|
42 |
+
chat_model_facebook_blenderbot_400M_distill = "facebook/blenderbot-400M-distill"
|
43 |
+
chat_model_HenryJJ_vincua_13b = "HenryJJ/vincua-13b"
|
44 |
|
45 |
# https://colab.research.google.com/drive/1hrS6_g14EcOD4ezwSGlGX2zxJegX5uNX#scrollTo=NUwUR9U7qkld
|
46 |
llm_hf = HuggingFaceHub(
|
47 |
+
repo_id= model,
|
48 |
model_kwargs={"temperature":0.9 }
|
49 |
)
|
50 |
|