I recently set up DeepSeek Coder V2 using Ollama. It's a new AI model for coding and math tasks. The setup was simple, its just running following command : ollama run deepseek-coder-v2:latest

But I ran into a problem - the model was responding in Chinese instead of English.

Since the model is new, there weren't many guides available. After some searching, I found the issue on GitHub. The problem was in Ollama's template configuration. Ollama’s template had an extra space : Assistant: {{ .Response }}


Here's how to fix it:


  1. Copy the model file: ollama show deepseek-coder-v2:latest --modelfile > new.modelfile
  2. Edit new.modelfile. Replace the TEMPLATE string between double quotes with:

{{ if .System }}{{ .System }} {{ end }}{{ if .Prompt }}User: {{ .Prompt }} {{ end }}Assistant:{{ .Response }}

  1. Create a new model with the fixed file: ollama create deepseek-coder-v2-custom --file new.modelfile

  2. Check if the new model is available : ollama list

After these steps, when you run your new model deepseek-coder-v2-custom, it should now respond in English.