[GH-ISSUE #12416] Please add: CWM (Code World Model) (from Meta) #70305

Closed
opened 2026-05-04 21:03:41 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @andyceo on GitHub (Sep 25, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12416

Please add support for CWM:

https://huggingface.co/facebook/cwm

Originally created by @andyceo on GitHub (Sep 25, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12416 Please add support for CWM: https://huggingface.co/facebook/cwm
GiteaMirror added the model label 2026-05-04 21:03:41 -05:00
Author
Owner

@rick-github commented on GitHub (Sep 27, 2025):

This model is llama architecture, so can be imported.

This template allows thinking control:

TEMPLATE """
{{- $lastUserIdx := -1 -}}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}
{{- end -}}

{{- if .System  }}<|start_header_id|>system<|end_header_id|>

{{ .System }}<|eot_id|>
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|start_header_id|>user<|end_header_id|>

{{ .Content }}<|eot_id|>
{{- else if eq .Role "assistant" }}<|start_header_id|>assistant<|end_header_id|>

{{ if and $.IsThinkSet .Thinking -}}
<think>
{{ .Thinking }}</think>
{{- end -}}
{{ .Content }}{{ if not $last }}<|eot_id|>{{ end }}
{{- end }}
{{- if and (ne .Role "assistant") $last }}<|start_header_id|>assistant<|end_header_id|>

{{ if and $.IsThinkSet $.Think }}<think>
{{ end -}}
{{ end }}
{{- end }}"""
$ ollama run cwm:32b-q4_K_M
>>> hello
Thinking...
Okay, the user just said "hello". That's a greeting. I should respond in 
kind to be friendly and welcoming. What's a good way to say hello back? 
Maybe "Hi there!" or something similar. But maybe I can add a bit more 
personality to it. Hmm... Alternatively, since I'm a large language model, 
perhaps I could make a light-hearted remark or ask how they're doing.
...done thinking.

Hello! It's nice to meet you. Is there something I can help you with or 
would you like to chat?

>>>
<!-- gh-comment-id:3341097981 --> @rick-github commented on GitHub (Sep 27, 2025): This model is llama architecture, so can be [imported](https://github.com/ollama/ollama/blob/main/docs/import.md#importing-a-model-from-safetensors-weights). This template allows thinking control: ```modelfile TEMPLATE """ {{- $lastUserIdx := -1 -}} {{- range $idx, $msg := .Messages -}} {{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}} {{- end -}} {{- if .System }}<|start_header_id|>system<|end_header_id|> {{ .System }}<|eot_id|> {{- end }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1 -}} {{- if eq .Role "user" }}<|start_header_id|>user<|end_header_id|> {{ .Content }}<|eot_id|> {{- else if eq .Role "assistant" }}<|start_header_id|>assistant<|end_header_id|> {{ if and $.IsThinkSet .Thinking -}} <think> {{ .Thinking }}</think> {{- end -}} {{ .Content }}{{ if not $last }}<|eot_id|>{{ end }} {{- end }} {{- if and (ne .Role "assistant") $last }}<|start_header_id|>assistant<|end_header_id|> {{ if and $.IsThinkSet $.Think }}<think> {{ end -}} {{ end }} {{- end }}""" ``` ```console $ ollama run cwm:32b-q4_K_M >>> hello Thinking... Okay, the user just said "hello". That's a greeting. I should respond in kind to be friendly and welcoming. What's a good way to say hello back? Maybe "Hi there!" or something similar. But maybe I can add a bit more personality to it. Hmm... Alternatively, since I'm a large language model, perhaps I could make a light-hearted remark or ask how they're doing. ...done thinking. Hello! It's nice to meet you. Is there something I can help you with or would you like to chat? >>> ```
Author
Owner

@ccebelenski commented on GitHub (Sep 30, 2025):

I added a quant of CWM to ollama.com - just search for cwm on ollama..com And let me know how I can improve the modelfile too!

<!-- gh-comment-id:3349813693 --> @ccebelenski commented on GitHub (Sep 30, 2025): I added a quant of CWM to ollama.com - just search for cwm on ollama..com And let me know how I can improve the modelfile too!
Author
Owner

@arthurwolf commented on GitHub (Nov 21, 2025):

@ccebelenski I can't find it, do you have a link?

<!-- gh-comment-id:3564177205 --> @arthurwolf commented on GitHub (Nov 21, 2025): @ccebelenski I can't find it, do you have a link?
Author
Owner

@rick-github commented on GitHub (Nov 21, 2025):

https://ollama.com/ccebelenski/cwm-q6_k

<!-- gh-comment-id:3564184172 --> @rick-github commented on GitHub (Nov 21, 2025): https://ollama.com/ccebelenski/cwm-q6_k
Author
Owner

@arthurwolf commented on GitHub (Nov 21, 2025):

@rick-github thank you so much.

<!-- gh-comment-id:3564186503 --> @arthurwolf commented on GitHub (Nov 21, 2025): @rick-github thank you so much.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#70305