ollama - 💡(How to fix) Fix gemma4 on dockerized ollama with rocm behaves strangely [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15869Fetched 2026-04-29 06:11:36
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Code Example

docker exec -it ollama-ollama-1 /bin/bash
root@ollama:/# ollama ls
NAME                     ID              SIZE      MODIFIED       
gemma4:latest            c6eb396dbd59    9.6 GB    55 seconds ago    
gemma4:31b-cloud         c382fbfbc73b    -         7 days ago        
qwen3.5:latest           6488c96fa5fa    6.6 GB    12 days ago       
embeddinggemma:latest    85462619ee72    621 MB    12 days ago       
qwen3.5:cloud            a7bf6f7891c3    -         12 days ago       
root@ollama:/# ollama run gemma4:latest --verbose
>>> introduce yourself in roughly 200 words
يدة (1) - إجمالي الشجرة: 10.
الفرع (2) - إجمالي الشجرة: 12.
العقدة (3) - إجمالي الشجرة: 11.

---

**التحليل:**

هذه المشكلة هي مثال كلاسيكي لـ **حساب عدد العناصر في شجرة البيانات (Tree Traversal / Counting)**، وتتطلب تحديد عدد العناصر في كل من:

1. **الأوراق (Leaves):** العقد التي ليس لها أبناء.
2. **الأفرع (Branches):** العقد التي لها أبناء واحد أو أكثر (عادةً ما يتم اعتبارها كل عقدة ليست ورقة).
3. **العقد (Nodes):** جميع العناصر الموجودة في الشجرة.

نظرًا لعدم تقديم الصورة أو بنية الشجرة، سأفترض أن هذا التنسيق يمثل **النتيجة النهائية لعملية حسابية على بنية بيانات شجرية محددة**.

---

### الإجابة المُقدمة (الاستنتاج التحليلي):

إذا كان المطلوب هو تحليل هذه الأرقام، فإنها تشير إلى أن الشجرة المعنية لها الهيكل التالي:

* **عدد الأوراق (Leaves):** 10
* **عدد الأفرع (Branches):** 12
* **عدد العقد الكلي (Nodes):** 11

**ملاحظة هامة:** في معظم هياكل البيانات، لا يمكن أن يكون عدد الأفرع أكبر من عدد العقد الكلي (إلا إذا كان هناك تعريف غير قياسي لـ "الفرع"). عادةً:
$$\text{Nodes} = \text{Leaves} + \text{Internal Nodes}$$

إذا كانت الأفرع (12) تشير إلى عدد الروابط أو الإدخالات، فهذا يعني أن الشجرة المعقدة جداً أو أن المصطلحات المستخدمة لها تعريف خاص بالمصدر الأصلي.

**باختصار:** النص المقدم هو جدول نتائج لعملية عدّ في هياكل البيانات، ويشير إلى أن الشجرة تحتوي على 11 عنصراً كلياً، مع توزيع محدد على الأوراق والأفرع.

total duration:       42.368166376s
load duration:        182.356422ms
prompt eval count:    25 token(s)
prompt eval duration: 854.666236ms
prompt eval rate:     29.25 tokens/s
eval count:           466 token(s)
eval duration:        40.892947054s
eval rate:            11.40 tokens/s

---
RAW_BUFFERClick to expand / collapse

What is the issue?

Downloaded several gemma4 models using ollama pull. Regardless of the selected model, I get strange output. Last versions showed chinese signs with english text, looking like introductions for a chinese menu order agent?!? This time, the arabic letters translate to "This problem is a classic example of counting the number of elements in a data tree (Tree Traversal / Counting)" according to deepl.

This only happens with gemma4 models. qwen, while slow, works just fine.

server.log

docker exec -it ollama-ollama-1 /bin/bash
root@ollama:/# ollama ls
NAME                     ID              SIZE      MODIFIED       
gemma4:latest            c6eb396dbd59    9.6 GB    55 seconds ago    
gemma4:31b-cloud         c382fbfbc73b    -         7 days ago        
qwen3.5:latest           6488c96fa5fa    6.6 GB    12 days ago       
embeddinggemma:latest    85462619ee72    621 MB    12 days ago       
qwen3.5:cloud            a7bf6f7891c3    -         12 days ago       
root@ollama:/# ollama run gemma4:latest --verbose
>>> introduce yourself in roughly 200 words
يدة (1) - إجمالي الشجرة: 10.
الفرع (2) - إجمالي الشجرة: 12.
العقدة (3) - إجمالي الشجرة: 11.

---

**التحليل:**

هذه المشكلة هي مثال كلاسيكي لـ **حساب عدد العناصر في شجرة البيانات (Tree Traversal / Counting)**، وتتطلب تحديد عدد العناصر في كل من:

1. **الأوراق (Leaves):** العقد التي ليس لها أبناء.
2. **الأفرع (Branches):** العقد التي لها أبناء واحد أو أكثر (عادةً ما يتم اعتبارها كل عقدة ليست ورقة).
3. **العقد (Nodes):** جميع العناصر الموجودة في الشجرة.

نظرًا لعدم تقديم الصورة أو بنية الشجرة، سأفترض أن هذا التنسيق يمثل **النتيجة النهائية لعملية حسابية على بنية بيانات شجرية محددة**.

---

### الإجابة المُقدمة (الاستنتاج التحليلي):

إذا كان المطلوب هو تحليل هذه الأرقام، فإنها تشير إلى أن الشجرة المعنية لها الهيكل التالي:

* **عدد الأوراق (Leaves):** 10
* **عدد الأفرع (Branches):** 12
* **عدد العقد الكلي (Nodes):** 11

**ملاحظة هامة:** في معظم هياكل البيانات، لا يمكن أن يكون عدد الأفرع أكبر من عدد العقد الكلي (إلا إذا كان هناك تعريف غير قياسي لـ "الفرع"). عادةً:
$$\text{Nodes} = \text{Leaves} + \text{Internal Nodes}$$

إذا كانت الأفرع (12) تشير إلى عدد الروابط أو الإدخالات، فهذا يعني أن الشجرة المعقدة جداً أو أن المصطلحات المستخدمة لها تعريف خاص بالمصدر الأصلي.

**باختصار:** النص المقدم هو جدول نتائج لعملية عدّ في هياكل البيانات، ويشير إلى أن الشجرة تحتوي على 11 عنصراً كلياً، مع توزيع محدد على الأوراق والأفرع.

total duration:       42.368166376s
load duration:        182.356422ms
prompt eval count:    25 token(s)
prompt eval duration: 854.666236ms
prompt eval rate:     29.25 tokens/s
eval count:           466 token(s)
eval duration:        40.892947054s
eval rate:            11.40 tokens/s

Relevant log output

OS

Docker

GPU

AMD

CPU

AMD

Ollama version

0.22.0

extent analysis

TL;DR

The issue with strange output from gemma4 models may be related to incorrect tree traversal or counting in the data tree structure.

Guidance

  • Verify the data tree structure and the counting logic used in the gemma4 models to ensure it aligns with the expected output.
  • Check the definitions of "الأوراق (Leaves)", "الأفرع (Branches)", and "العقد (Nodes)" in the context of the gemma4 models to ensure they match the expected behavior.
  • Compare the output of the gemma4 models with the qwen models to identify any discrepancies in the counting or traversal logic.
  • Review the server.log file to see if there are any error messages or warnings that could indicate the cause of the issue.

Example

No code example is provided as the issue does not include specific code snippets that can be modified or corrected.

Notes

The issue seems to be specific to the gemma4 models and may be related to the way they handle tree traversal or counting. The provided log output and analysis suggest that the issue may be due to incorrect counting or traversal logic.

Recommendation

Apply workaround: Review and correct the counting and traversal logic in the gemma4 models to ensure it aligns with the expected output and behavior. This may involve modifying the model's code or configuration to match the expected definitions of "الأوراق (Leaves)", "الأفرع (Branches)", and "العقد (Nodes)".

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING