dnzblgn commited on
Commit
3a56bef
·
verified ·
1 Parent(s): 21a7915

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -10,7 +10,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSequen
10
  sent = "dnzblgn/Sentiment-Analysis-Customer-Reviews"
11
  sarc = "dnzblgn/Sarcasm-Detection-Customer-Reviews"
12
  doc = "dnzblgn/Customer-Reviews-Classification"
13
- embedding_model = SentenceTransformer('all-MiniLM-L6-v2') # Lightweight embedding model for CPU
14
 
15
  # Your models (no token, no fast tokenizer)
16
  sentiment_tokenizer = AutoTokenizer.from_pretrained("dnzblgn/Sentiment-Analysis-Customer-Reviews", use_fast=False)
@@ -22,9 +22,10 @@ sarcasm_model = AutoModelForSequenceClassification.from_pretrained("dnzblgn/Sarc
22
  classification_tokenizer = AutoTokenizer.from_pretrained("dnzblgn/Customer-Reviews-Classification", use_fast=False)
23
  classification_model = AutoModelForSequenceClassification.from_pretrained("dnzblgn/Customer-Reviews-Classification")
24
 
25
- # Lightweight Causal Language Model (distilgpt2 instead of Mistral)
26
- causal_tokenizer = AutoTokenizer.from_pretrained("distilgpt2")
27
- causal_model = AutoModelForCausalLM.from_pretrained("distilgpt2").eval() # Ensure evaluation mode
 
28
 
29
  # Paths and files
30
  UPLOAD_FOLDER = "uploads"
 
10
  sent = "dnzblgn/Sentiment-Analysis-Customer-Reviews"
11
  sarc = "dnzblgn/Sarcasm-Detection-Customer-Reviews"
12
  doc = "dnzblgn/Customer-Reviews-Classification"
13
+ embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
14
 
15
  # Your models (no token, no fast tokenizer)
16
  sentiment_tokenizer = AutoTokenizer.from_pretrained("dnzblgn/Sentiment-Analysis-Customer-Reviews", use_fast=False)
 
22
  classification_tokenizer = AutoTokenizer.from_pretrained("dnzblgn/Customer-Reviews-Classification", use_fast=False)
23
  classification_model = AutoModelForSequenceClassification.from_pretrained("dnzblgn/Customer-Reviews-Classification")
24
 
25
+ # ** Mistral model for RAG **
26
+ mistral_model_name = "mistralai/Mistral-7B-v0.1"
27
+ causal_tokenizer = AutoTokenizer.from_pretrained(mistral_model_name)
28
+ causal_model = AutoModelForCausalLM.from_pretrained(mistral_model_name, torch_dtype=torch.float16).eval()
29
 
30
  # Paths and files
31
  UPLOAD_FOLDER = "uploads"