Update app.py
Browse files
app.py
CHANGED
@@ -323,7 +323,7 @@ def phonetic_match(text, query, method='levenshtein_distance', apply_phonetic=Fa
|
|
323 |
|
324 |
from typing import List, Union
|
325 |
import torch
|
326 |
-
from transformers import AutoTokenizer
|
327 |
import numpy as np
|
328 |
from nltk.tokenize import word_tokenize
|
329 |
from nltk.corpus import wordnet
|
@@ -375,7 +375,7 @@ def optimize_query(
|
|
375 |
model_max_length=128, # Limit maximum sequence length
|
376 |
cache_dir="./model_cache" # Cache models locally
|
377 |
)
|
378 |
-
model =
|
379 |
model_name,
|
380 |
low_cpu_mem_usage=True, # Enable low memory usage
|
381 |
device_map="cpu" # Explicitly set to CPU
|
|
|
323 |
|
324 |
from typing import List, Union
|
325 |
import torch
|
326 |
+
from transformers import AutoTokenizer
|
327 |
import numpy as np
|
328 |
from nltk.tokenize import word_tokenize
|
329 |
from nltk.corpus import wordnet
|
|
|
375 |
model_max_length=128, # Limit maximum sequence length
|
376 |
cache_dir="./model_cache" # Cache models locally
|
377 |
)
|
378 |
+
model = AutoModel.from_pretrained(
|
379 |
model_name,
|
380 |
low_cpu_mem_usage=True, # Enable low memory usage
|
381 |
device_map="cpu" # Explicitly set to CPU
|