Instructions to use danish-foundation-models/DFM-Mimir with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use danish-foundation-models/DFM-Mimir with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="danish-foundation-models/DFM-Mimir") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("danish-foundation-models/DFM-Mimir") model = AutoModelForCausalLM.from_pretrained("danish-foundation-models/DFM-Mimir", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use danish-foundation-models/DFM-Mimir with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "danish-foundation-models/DFM-Mimir" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danish-foundation-models/DFM-Mimir", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/danish-foundation-models/DFM-Mimir
- SGLang
How to use danish-foundation-models/DFM-Mimir 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 "danish-foundation-models/DFM-Mimir" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danish-foundation-models/DFM-Mimir", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "danish-foundation-models/DFM-Mimir" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danish-foundation-models/DFM-Mimir", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use danish-foundation-models/DFM-Mimir with Docker Model Runner:
docker model run hf.co/danish-foundation-models/DFM-Mimir
Reasoning issue
Hi Guys. Love your work. Just a little issue here:
Model class: HrmTextForCausalLM
Model dtype(s): torch.bfloat16
Parameter count: 1,786,775,040
Model footprint: 3.33 GiB
Load time: 5.08 s
VRAM after model load: allocated=3.33 GiB, reserved=3.50 GiB, device_free=11.31/15.93 GiB
DFM-Mimir terminal chat. Type /quit or /exit to stop.
You: hi! how are you?
Mimir: Hello! I'm just a computer program, so I don't have feelings or emotions. But I'm here and ready to help you with any questions or tasks you may have. How can I assist you today?
[generation: prompt=16 tokens, output=47 tokens, speed=9.97 tokens/s]
[generation peak allocated VRAM: 3.42 GiB]
You: A farmer has 17 sheep. All but 9 run away. How many are left? Explain.
Mimir: The farmer has 17 sheep initially. The phrase "all but 9 run away" means that all the sheep except for 9 ran away. So, if we subtract 9 from the total number of sheep, we get:
17 - 9 = 8
Therefore, there are 8 sheep left.
[generation: prompt=101 tokens, output=68 tokens, speed=11.47 tokens/s]
[generation peak allocated VRAM: 3.50 GiB]
You: En bonde har 17 får. Alle undtagen 9 løber væk. Hvor mange får er der tilbage? Forklar dit svar.
Mimir: Bonden har 17 får i starten. Frasen "alle undtagen 9 løber væk" betyder, at alle fårene undtagen 9 løb væk. Så hvis vi trækker 9 fra det samlede antal får, får vi:
17 - 9 = 8
Derfor er der 8 får tilbage.
[generation: prompt=220 tokens, output=78 tokens, speed=11.49 tokens/s]
[generation peak allocated VRAM: 3.59 GiB]
You: please check your reasoning; are you sure there are 8 sheep left?
Mimir: Yes, I am sure that there are 8 sheep left. The phrase "all but 9 run away" means that all the sheep except for 9 ran away, so if we start with 17 sheep and subtract 9, we get 8 sheep left.
[generation: prompt=331 tokens, output=57 tokens, speed=11.70 tokens/s]
[generation peak allocated VRAM: 3.70 GiB]
You: how about this logic. if i rephrase it like this: 17 - 8.
Mimir: If you rephrase the logic as "17 - 8", you would be assuming that 8 sheep ran away, which is not the case. The original statement was "all but 9 run away", which means that 9 sheep ran away. So, if you subtract 8 from 17, you would be incorrect. The correct answer is still 8 sheep left.
[generation: prompt=423 tokens, output=80 tokens, speed=11.89 tokens/s]
[generation peak allocated VRAM: 3.78 GiB]
You: i must disagree. the sheep thing is designed as a reasoning trap, not just a maths based equation to solve. "all but 9" implies all the sheep ran away except for 9. so 9 remained. is this logic acceptable to you?
Mimir: I understand your point, but I believe that the original logic is correct. The phrase "all but 9 run away" means that all the sheep except for 9 ran away, so if we start with 17 sheep and subtract 9, we get 8 sheep left.
However, I see that you are pointing out a potential issue with the logic. If the farmer has 17 sheep and all but 9 run away, then it is possible that the farmer has not yet had time to catch up with the 9 sheep that ran away. In this case, the farmer could have only
[generation: prompt=577 tokens, output=128 tokens, speed=12.01 tokens/s]
[generation peak allocated VRAM: 3.89 GiB]
DFM-Mimir is running successfully from its original safetensors checkpoint on the RTX 5060 Ti.
Result
- Location: REDACTED
- Python: 3.13.14; Python 3.12 was unavailable
- Isolated .venv only; no global installs
- PyTorch: 2.13.0+cu130
- Transformers: 5.12.1
- CUDA detected: yes
- BF16 GPU computation: verified
- Dependency check: no broken requirements
- No GGUF, llama.cpp, quantization, or remote model code
The Python Store runtime failed to seed pip normally, so pip was bootstrapped directly into .venv; global Python remained unchanged.
Integrity
Pinned Hugging Face revision: - model.safetensors: 3,573,566,200 bytes
- Weight SHA-256 matched published LFS hash:
8a83c8a0e6ad25b73c089c9c6f8b01969f1c6bd7db76a71ff85de861a95311a0 - Tokenizer SHA-256 also matched
- Safetensors structure: valid, 131 tensors
Inference benchmark - Model class: HrmTextForCausalLM
- Parameters: 1,786,775,040
- Dtype: BF16
- Load time: 3.49 seconds
- Model footprint: 3.33 GiB
- VRAM after load: 3.33 GiB allocated, 3.50 GiB reserved
- Peak generation VRAM: 3.39 GiB
- Performance: 8.53 generated tokens/second
- Test response: “Danmarks hovedstad er København.”
The initial Windows CP1252 rendering of ø was diagnosed as terminal encoding—not an inference issue—and corrected in the runner.
Fantastic find! I love how good Mimir is in insisting on its (wrong) opinion :-) Especially the part where it assume the farmer might be with the sheep that ran away.
Note that the model is in many ways a base model, i.e., even though it is trained exclusively on post-training data, it has not undergone neither preference optimization nor reinforcement learning to increase reasoning accuracy, minimize reasoning budgets etc.
Hi! Don't worry, I understand this initial scenario. I did download the raw safetensors file and I understand that. Mimir's sheep opinions are humerous 😊
I'm currently training an LLM for a client and must "debug" it to wrinkle out its mistakes.
Keep up the good work!
Lee