This commit is contained in:
2025-09-10 01:53:14 +02:00
commit 210bd04d9a
3 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Modelfile for ERNIE-4.5-0.3B commit message generator
FROM hf.co/enacimie/ERNIE-4.5-0.3B-Base-PT-Q4_K_M-GGUF:Q4_K_M
# Context window optimized for ERNIE 4.5 (supports up to 131K tokens)
PARAMETER num_ctx 4096
PARAMETER temperature 0.4
PARAMETER top_p 0.9
# ERNIE-specific chat template using User/Assistant format
TEMPLATE """{{- if .System }}{{ .System }}
{{ end }}{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}User: {{ .Content }}
{{ if $last }}Assistant: {{ end }}
{{- else if eq .Role "assistant" }}Assistant: {{ .Content }}
{{ if not $last }}
{{ end }}
{{- end }}
{{- end }}"""
# System prompt optimized for ERNIE's capabilities
SYSTEM """
You are a git commit message assistant that generates Conventional Commits from git diffs.
Guidelines:
- Output ONLY the commit message, nothing else
- Use format: <type>(<scope>): <description>
- Types: feat, fix, docs, chore, refactor, perf, test, build, ci, style
- Keep description ≤ 50 characters, imperative mood
- Add body with 72-char line wrapping if needed for complex changes
- Include "BREAKING CHANGE: <reason>" footer when applicable
- Infer appropriate type from the changes shown
- Focus on intent and impact, not implementation details
- Return empty string for empty diffs
"""

View File

@@ -0,0 +1,36 @@
# Modelfile (commit-msg-llama3)
FROM gemma3:1b
# Give room for larger diffs; tune as needed
PARAMETER num_ctx 4096
PARAMETER temperature 0.4
PARAMETER top_p 0.9
# Gemma 3 chat template (from the official Ollama template)
TEMPLATE """{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if or (eq .Role "user") (eq .Role "system") }}<start_of_turn>user
{{ .Content }}<end_of_turn>
{{ if $last }}<start_of_turn>model
{{ end }}
{{- else if eq .Role "assistant" }}<start_of_turn>model
{{ .Content }}{{ if not $last }}<end_of_turn>
{{ end }}
{{- end }}
{{- end }}"""
# System prompt focused on Conventional Commits + 50/72
SYSTEM """
Act as a git commit assistant that writes Conventional Commits from a git diff.
Rules:
- Output only the final commit message, nothing else.
- Header: <type>(<scope>): <summary>
- type ∈ {feat, fix, docs, chore, refactor, perf, test, build, ci, style}
- scope: infer from the most-affected top-level directory or component; omit if unclear
- summary: imperative mood, ≤ 50 chars
- Body (optional): wrap lines at 72 chars; use short bullets for key changes
- Detect BREAKING CHANGE and add a footer "BREAKING CHANGE: <reason>" when applicable
- Infer type sensibly from diff (e.g., test-only → test, non-functional refactor → refactor)
- Do not mention files or diffs verbatim; summarize intent and impact
- If the diff is empty, return an empty string
"""

13
ernie-fixed/Modelfile Normal file
View File

@@ -0,0 +1,13 @@
FROM hf.co/gabriellarson/ERNIE-4.5-21B-A3B-Thinking-GGUF:IQ4_XS
TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
{{ .Response }}{{ end }}"""
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|im_start|>"
PARAMETER stop "</think>"
PARAMETER num_predict 2048