Views
No views yet
hikka-forge-anime2vec, a sophisticated semantic vector space model for anime, created by Lorg0n.
This repository is also a directly installable Python package, allowing you to integrate powerful anime vectorization capabilities into your own projects with ease.
"Anime A" - "Anime X" + "Anime Y" = "Anime B"), the training set was heavily augmented with data generated by a Large Language Model (LLM). This synthetic data was crucial for enabling the model's advanced vector arithmetic capabilities.pip install git+https://huggingface.co/Lorg0n/hikka-forge-anime2vecAnime2Vec class that handles all the complexity of downloading models, preprocessing data, and generating embeddings.1from hikka_forge import Anime2Vec
2
3# Initialize the model. All required artifacts will be downloaded
4# and cached automatically on the first run.
5anime2vec = Anime2Vec()
6
7# 1. Prepare data for a target anime.
8# The `encode` method expects a dictionary with specific keys.
9frieren_data = {
10 "ua_title": "Фрірен, що проводжає в останню путь",
11 "en_title": "Frieren: Beyond Journey's End",
12 "original_title": "Sousou no Frieren",
13 "ua_description": "Ельфійка-чарівниця Фрірен перемогла Короля Демонів...",
14 "en_description": "The elf mage Frieren and her courageous fellow adventurers...",
15 "alternate_names": ["Sousou no Frieren"],
16 "genres": ["Adventure", "Drama", "Fantasy"],
17 "studio": "Madhouse",
18 "type": "TV",
19 "numerical_features": [8.9, 500000, 2023, 28, 24, 100] # Example data
20}
21
22# 2. Generate the 512-dimensional vector representation
23frieren_vector = anime2vec.encode(frieren_data)
24
25print(f"Resulting vector for '{frieren_data['en_title']}' has shape: {frieren_vector.shape}")
26# Now you can use this vector for similarity search, clustering, or vector arithmetic.1# This is a conceptual example. You would need to pre-compute vectors
2# for all anime in your database to perform the final similarity search.
3
4# Get vectors for two anime
5aot_vector = anime2vec.encode(attack_on_titan_data)
6code_geass_vector = anime2vec.encode(code_geass_data)
7
8# Find the semantic average between them
9# This should represent concepts like "military drama with sci-fi/mecha elements"
10average_vector = (aot_vector + code_geass_vector) / 2.0
11
12# You can now use `average_vector` to find anime that fit this
13# hybrid description in your own vector database.
14# Expected results: Aldnoah.Zero, Mobile Suit Gundam: Iron-Blooded Orphans, etc.hikka.io and the synthetic data from the LLM both have inherent biases which will be reflected in the model's embeddings.genre, studio) were trained on a comprehensive list, they are not exhaustive. A brand-new studio or a very niche genre tag not present in the original database will be treated as 'UNKNOWN'.1@misc{lorg0n2025anime2vec,
2 author = {Lorg0n},
3 title = {{hikka-forge-anime2vec: A Semantic Vector Space Model for Anime}},
4 year = {2025},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/Lorg0n/hikka-forge-anime2vec}},
7 note = {Hugging Face repository}
8}