Aleksei Ovchenkov commited on
Commit
5e0be4d
·
1 Parent(s): 81f24b9
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -9,6 +9,7 @@ from sklearn.preprocessing import LabelEncoder
9
  tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-cased')
10
 
11
  # Загружаем квантизированную модель
 
12
  def load_quantized_model(model_path, num_labels):
13
  model = DistilBertForSequenceClassification.from_pretrained('distilbert-base-cased', num_labels=num_labels)
14
  model.load_state_dict(torch.load(model_path, map_location=torch.device('cpu'))['model_state_dict'])
 
9
  tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-cased')
10
 
11
  # Загружаем квантизированную модель
12
+ @st.cache_resource
13
  def load_quantized_model(model_path, num_labels):
14
  model = DistilBertForSequenceClassification.from_pretrained('distilbert-base-cased', num_labels=num_labels)
15
  model.load_state_dict(torch.load(model_path, map_location=torch.device('cpu'))['model_state_dict'])