HEHEBOIOG commited on
Commit
f11ecb6
1 Parent(s): 50ded28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -4,6 +4,7 @@ from sklearn.feature_extraction.text import TfidfVectorizer
4
  from sklearn.metrics.pairwise import cosine_similarity
5
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
6
  from sentence_transformers import SentenceTransformer, util
 
7
  import torch
8
 
9
  import gdown
@@ -21,10 +22,12 @@ except UnicodeDecodeError:
21
  vectorizer = TfidfVectorizer(stop_words='english')
22
  X_tfidf = vectorizer.fit_transform(medical_df['Questions'])
23
 
24
- # Load pre-trained GPT-2 model and tokenizer
25
- model_name = "sshleifer/tiny-gpt2"
26
- tokenizer = GPT2Tokenizer.from_pretrained(model_name)
27
- model = GPT2LMHeadModel.from_pretrained(model_name)
 
 
28
 
29
  # Load pre-trained Sentence Transformer model
30
  sbert_model_name = "paraphrase-MiniLM-L6-v2"
 
4
  from sklearn.metrics.pairwise import cosine_similarity
5
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
6
  from sentence_transformers import SentenceTransformer, util
7
+ from transformers import AutoTokenizer, AutoModelForCausalLM
8
  import torch
9
 
10
  import gdown
 
22
  vectorizer = TfidfVectorizer(stop_words='english')
23
  X_tfidf = vectorizer.fit_transform(medical_df['Questions'])
24
 
25
+
26
+ # Load TinyLlama-15M model and tokenizer
27
+ model_name = "nickypro/tinyllama-15M"
28
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
29
+ model = AutoModelForCausalLM.from_pretrained(model_name)
30
+
31
 
32
  # Load pre-trained Sentence Transformer model
33
  sbert_model_name = "paraphrase-MiniLM-L6-v2"