MTG-GloVe-Commander: Semantic Card Embeddings
MTG-GloVe-Commander is a 128-dimensional embedding model trained on Magic: The Gathering Commander decklists. This model is trained on 5M co-occurring card pairs in commander deck construction across varying sets and metagames and as a result features a large vocabulary of cards (25537).
Because the model was trained with Weighted Least Squares and high-frequency subsampling, it captures linear substructures. You can perform algebraic operations on card concepts with moderately high accuracy.
Elvish Archdruid - Llanowar Elves + Gravecrawler:
1. Unholy Grotto (cos=0.7198)
2. Cryptbreaker (cos=0.7107)
3. Lord of the Undead (cos=0.7062)
4. Undead Warchief (cos=0.7051)
5. Zombie Master (cos=0.6963)
Wrath of God - Plains + Swamp:
1. Damnation (cos=0.6931)
2. Bojuka Bog (cos=0.6323)
3. Demonic Tutor (cos=0.6229)
4. Urborg, Tomb of Yawgmoth (cos=0.6165)
5. Vampiric Tutor (cos=0.5818)
Swords to Plowshares - Plains + Mountain:
1. Blasphemous Act (cos=0.7980)
2. Chaos Warp (cos=0.7101)
3. Vandalblast (cos=0.7100)
4. Deflecting Swat (cos=0.6882)
5. Command Tower (cos=0.6582)
Interactive Demo
An interactive demo of the embedding space is available as a space here
Usage
import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer
# Load model and tokenizer
model_id = "nishtahir/mtg-glove-embedding-commander"
model = AutoModel.from_pretrained(model_id, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
def get_vector(card_name):
card_id = tokenizer.convert_tokens_to_ids(card_name)
if card_id == tokenizer.unk_token_id:
raise ValueError(f"Card '{card_name}' not found in vocabulary.")
with torch.no_grad():
return model.get_combined_embeddings()[card_id] # Uses (Center + Context) / 2
v_sol_ring = get_vector("Sol Ring")
print(f"Vector shape: {v_sol_ring.shape}") # torch.Size([128])
Limitations
- Vectors are optimized for Commander. A card that is good in Modern but bad in Commander (e.g., Ragavan, Nimble Pilferer) will have a vector reflecting its Commander usage (mediocre) rather than its raw power level.
- No Rules Text: The model does not read text. If a card was released yesterday and has no deck data, the model cannot generate an embedding for it.
- New Sets: Cards released after the training snapshot will not be in the vocabulary.
- Downloads last month
- 41
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support