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
Is this really a 1B model?
The model gets detected as 2B - and the file is ~3.6GB, while typical 1B models (such as Gemma 3) at the same precision (BF16) are generally in the area of ~2.0GB.
Is it a 1B model or what are you leaving out? π
Great question. The model has under 1B parameters without the embeddings and the language modelling head. Taking into account the language modelling head, which is approx. 0.4B parameters, we land at 1.3B. The remaining 0.4B are the embeddings.
without the embeddings and the language modelling head
when did we start measuring language models without their embeddings or head?
I'm genuinely asking, because I've come across two other projects recently trying to do the same thing, and it's honestly just confusing.
Correct me if I'm wrong, but usually, if you see e.g. "1B at 8BFP", you'd expect to see a ~1GB file, right?
has the whole industry recently decided it's more important to look competitive than it is to provide us with the real dimensions? π
it feels like obfuscation, and it makes it difficult to compare... "1B" to begin with can already mean a lot of different things - from your 3.6GB model down to Bonsai/BitNet type models at a few hundred MB.
speaking of, will you be shipping quantized versions, and do you have any idea what sort of performance we can expect there? 16 bits per parameter is a bit high by today's standards for small models? π
I am sorry if you believe we have been misleading. It is not completely uncommon, many models vary in their reported size by quite a bit and we are by no means the first to focus on the active parameters and discount the embedding layer.
E.g. over at MTEB we report active parameters as it closer reflects the runtime and ecologits use active parameter to estimate energy usage.
Huggingface luckily allow you to inspect the dimensions on each layer, so it the numbers should be there for you to inspect.
I donβt know of any plans to make a low precision version of the model.
redacted