Downloads · 30 days
89
9% of all-time downloads
Lorg0n/hikka-forge-paraphrase-multilingual-MiniLM-L12-v2
hikka-forge-paraphrase-multilingual-MiniLM-L12-v2 is a sentence similarity model from Lorg0n. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as apache-2.0.
This is a sentence-transformers model fine-tuned from sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2. It is specifically trained to map Ukrainian and English sentences & paragraphs from the anime domain i…
Downloads · 30 days
89
9% of all-time downloads
All-time downloads
1K
Public
Parameters
118M
6.6 GB on disk
Likes
2
Public
Click a slice to open those files.
.pt3.8 GB · 52%
From the Hugging Face model README
This is a sentence-transformers model fine-tuned from sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2. It is specifically trained to map Ukrainian and English sentences & paragraphs from the anime domain into a 384-dimensional dense vector space.
The model is designed for tasks such as semantic search, textual similarity, and clustering within an anime context. It excels at capturing not only direct keywords but also abstract concepts, genres, and the overall atmosphere of a title.
The training dataset was provided by hikka.io, a comprehensive Ukrainian encyclopedia for anime, manga, and light novels.
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2First, install the Sentence Transformers library:
pip install -U sentence-transformers
Then, you can load the model and use it for semantic search or similarity tasks.
from sentence_transformers import SentenceTransformer, util
# Download the model from the 🤗 Hub
model = SentenceTransformer("Lorg0n/hikka-forge-paraphrase-multilingual-MiniLM-L12-v2")
# Example query (can be in Ukrainian or English)
query = "аніме про меланхолійну подорож після перемоги над королем демонів"
# "anime about a melancholic journey after defeating the demon king"
# A corpus of documents to search through
corpus = [
"Frieren is an elf mage who was part of the hero's party that defeated the Demon King. After the journey, she witnesses her human companions pass away due to old age and embarks on a new journey to understand humanity.",
"To Your Eternity follows an immortal being sent to Earth with no emotions nor identity. The being is able to take on the shape of those that leave a strong impression on it.",
"K-On! is a lighthearted story about four high school girls who join the light music club to save it from being disbanded. They spend their days practicing, performing, and hanging out together."
]
# Encode the query and corpus into dense vector embeddings
query_embedding = model.encode(query, convert_to_tensor=True)
corpus_embeddings = model.encode(corpus, convert_to_tensor=True)
# Compute cosine similarity scores
cosine_scores = util.cos_sim(query_embedding, corpus_embeddings)
# Print the results
print(f"Query: {query}\n")
for i, score in enumerate(cosine_scores[0]):
print(f"Similarity: {score:.4f}\t | Document: {corpus[i][:80]}...")
# Expected Output:
# Query: аніме про меланхолійну подорож після перемоги над королем демонів
#
# Similarity: 0.4013 | Document: Frieren is an elf mage who was part of the hero's party that defeated the Demon ...
# Similarity: 0.1800 | Document: To Your Eternity follows an immortal being sent to Earth with no emotions nor id...
# Similarity: 0.0091 | Document: K-On! is a lighthearted story about four high school girls who join the light mu...
The model was fine-tuned on a proprietary, high-quality dataset from hikka.io, consisting of 177,822 carefully constructed training pairs. The dataset was engineered to teach the model various semantic relationships within the anime domain:
Cross-lingual Connections (UA ↔ EN):
ua_title ↔ en_synopsis).ua_title ↔ en_title).Бойовик ↔ Action).Intra-lingual Connections (UA ↔ UA, EN ↔ EN):
Metadata & Synonymy Injection:
MultipleNegativesRankingLoss, a highly effective method for learning semantic similarity. It utilizes other examples in a batch as negative samples, which is a very efficient training paradigm.The fine-tuned model demonstrates a significantly improved understanding of domain-specific and abstract concepts compared to the base model. During evaluation, it showed:
"a calming, healing 'iyashikei' anime", while the base model returned more generic results."деконструкція жанру махо-шьоджьо, де дівчата-чарівниці страждають психологічно" (deconstruction of the maho-shoujo genre where magical girls suffer psychologically).learning_rate: 2e-05per_device_train_batch_size: 32num_train_epochs: 4warmup_ratio: 0.1fp16: Trueloss: MultipleNegativesRankingLoss@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}