This model is a fine-tuned version of sentence-transformers/LaBSE on my news dataset. The goal of this model was to create a universal model for categorizing Russian-language news that would preserve the ability of the basic LaBSE model to generate multi-lingual text embeddings in a single vector space. It should be noted that the model allows to classify news articles in other languages available in LaBSE, but the quality of such classification will be worse than Russian-language news texts. The learning news dataset is a well-balanced sample of recent news from the last five years.
It achieves the following results on the evaluation set:
from openmind import omdatasets, pipeline, is_torch_npu_available, AutoTokenizer
import argparse
import time
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
help="Path to model",
default="zhouhui/frozen_news_classifier_ft",
)
args = parser.parse_args()
return args
args = parse_args()
model_path = args.model_name_or_path
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
#device = "cpu"
start_time = time.time()
unmasker = pipeline('text-classification', model=model_path,device=device)
print(unmasker("The man worked as a <mask>."))
end_time = time.time()
print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
Compared to my specialized model any-news-classifier, which is designed to solve news classification problems, this model shows meaningfully worse metrics.
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 | Precision | Recall |
|---|---|---|---|---|---|---|---|
| 0.8422 | 1.0 | 3596 | 0.8104 | 0.7681 | 0.7632 | 0.7669 | 0.7681 |
| 0.7923 | 2.0 | 7192 | 0.7738 | 0.7711 | 0.7666 | 0.7700 | 0.7711 |
| 0.7597 | 3.0 | 10788 | 0.7485 | 0.7754 | 0.7716 | 0.7741 | 0.7754 |
| 0.7564 | 4.0 | 14384 | 0.7314 | 0.7793 | 0.7753 | 0.7785 | 0.7793 |