Spaces:
Runtime error
Runtime error
Update functions.py
Browse files- functions.py +1 -45
functions.py
CHANGED
@@ -15,6 +15,7 @@ from nltk.stem import WordNetLemmatizer
|
|
15 |
import re
|
16 |
from sklearn.metrics.pairwise import cosine_similarity
|
17 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
|
|
18 |
|
19 |
|
20 |
# In[47]:
|
@@ -188,51 +189,6 @@ def recommend_from_dataset(query):
|
|
188 |
return recommendations
|
189 |
|
190 |
|
191 |
-
# In[36]:
|
192 |
-
|
193 |
-
|
194 |
-
# def fine_tune_model(model_name, train_dataset, validation_dataset, epochs=3):
|
195 |
-
# # Load model and tokenizer
|
196 |
-
# model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
197 |
-
# tokenizer = AutoTokenizer.from_pretrained(model_name)
|
198 |
-
|
199 |
-
# # Define training arguments (adjust parameters as needed)
|
200 |
-
# training_args = TrainingArguments(
|
201 |
-
# output_dir="./results", # Adjust output directory
|
202 |
-
# per_device_train_batch_size=8,
|
203 |
-
# per_device_eval_batch_size=8,
|
204 |
-
# num_train_epochs=epochs,
|
205 |
-
# save_steps=10_000,
|
206 |
-
# )
|
207 |
-
|
208 |
-
# # Create a Trainer instance for fine-tuning
|
209 |
-
# trainer = Trainer(
|
210 |
-
# model=model,
|
211 |
-
# args=training_args,
|
212 |
-
# train_dataset=train_dataset,
|
213 |
-
# eval_dataset=validation_dataset,
|
214 |
-
# tokenizer=tokenizer,
|
215 |
-
# )
|
216 |
-
|
217 |
-
# # Train the model
|
218 |
-
# trainer.train()
|
219 |
-
|
220 |
-
# return model
|
221 |
-
|
222 |
-
|
223 |
-
# In[39]:
|
224 |
-
|
225 |
-
|
226 |
-
# train_dataset = ... # Prepare your training dataset
|
227 |
-
# validation_dataset = ... # Prepare your validation dataset
|
228 |
-
|
229 |
-
# # Fine-tune the model (replace model name if needed)
|
230 |
-
# fine_tuned_model = fine_tune_model("facebook/bart-base", train_dataset, validation_dataset)
|
231 |
-
|
232 |
-
# # Update summarization pipeline with the fine-tuned model
|
233 |
-
# summarizer1 = pipeline("text-generation", model=fine_tuned_model, tokenizer=fine_tuned_model.tokenizer)
|
234 |
-
|
235 |
-
|
236 |
# In[45]:
|
237 |
|
238 |
|
|
|
15 |
import re
|
16 |
from sklearn.metrics.pairwise import cosine_similarity
|
17 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
18 |
+
from nltk.corpus import wordnet
|
19 |
|
20 |
|
21 |
# In[47]:
|
|
|
189 |
return recommendations
|
190 |
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
# In[45]:
|
193 |
|
194 |
|