Instructions to use minimaxir/magic-the-gathering with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use minimaxir/magic-the-gathering with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="minimaxir/magic-the-gathering")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("minimaxir/magic-the-gathering") model = AutoModelForCausalLM.from_pretrained("minimaxir/magic-the-gathering") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use minimaxir/magic-the-gathering with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "minimaxir/magic-the-gathering" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minimaxir/magic-the-gathering", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/minimaxir/magic-the-gathering
- SGLang
How to use minimaxir/magic-the-gathering with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "minimaxir/magic-the-gathering" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minimaxir/magic-the-gathering", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "minimaxir/magic-the-gathering" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minimaxir/magic-the-gathering", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use minimaxir/magic-the-gathering with Docker Model Runner:
docker model run hf.co/minimaxir/magic-the-gathering
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
magic-the-gathering
A small (~1M parameters) GPT-2 model trained on Magic: The Gathering cards from sets up to and including Strixhaven and Commander 2021.
The model was trained 8 hours on a V100 on about ~22k unique encoded cards, with 10 permutations of each possible card.
Examples of encoded cards:
<|toughness|><|text|>Counter target spell unless its controller pays {X}.<|power|><|type|>Instant<|loyalty|><|manaCost|>{X}{U}<|name|>Clash of Wills
<|loyalty|><|text|>~ enters the battlefield tapped.
{T}: Add {C}.
{T}: Add {U} or {R}. ~ deals 1 damage to you.<|toughness|><|name|>Caldera Lake<|power|><|manaCost|><|type|>Land
<|loyalty|>5<|text|>+1: Scry 1, then draw a card.
β2: Return target creature to its owner's hand.
β8: You get an emblem with "Whenever an opponent casts their first spell each turn, counter that spell."<|name|>Jace, Unraveler of Secrets<|toughness|><|type|>Legendary Planeswalker β Jace<|manaCost|>{3}{U}{U}<|power|>
The generated cards follow a similar schema, however because the model learns all possible permutations of the schema, the user can prompt the generation with any combination of schema.
- Downloads last month
- 16