From 210bd04d9a76e3c5360eb43522154a63b1aad62b Mon Sep 17 00:00:00 2001 From: Matthias Puchstein Date: Wed, 10 Sep 2025 01:53:14 +0200 Subject: [PATCH] init --- commit-msg-ernie/Modelfile | 37 +++++++++++++++++++++++++++++++++++++ commit-msg-gemma3/Modelfile | 36 ++++++++++++++++++++++++++++++++++++ ernie-fixed/Modelfile | 13 +++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 commit-msg-ernie/Modelfile create mode 100644 commit-msg-gemma3/Modelfile create mode 100644 ernie-fixed/Modelfile diff --git a/commit-msg-ernie/Modelfile b/commit-msg-ernie/Modelfile new file mode 100644 index 0000000..952c534 --- /dev/null +++ b/commit-msg-ernie/Modelfile @@ -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: (): +- 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: " footer when applicable +- Infer appropriate type from the changes shown +- Focus on intent and impact, not implementation details +- Return empty string for empty diffs +""" diff --git a/commit-msg-gemma3/Modelfile b/commit-msg-gemma3/Modelfile new file mode 100644 index 0000000..4abed28 --- /dev/null +++ b/commit-msg-gemma3/Modelfile @@ -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") }}user +{{ .Content }} +{{ if $last }}model +{{ end }} +{{- else if eq .Role "assistant" }}model +{{ .Content }}{{ if not $last }} +{{ 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 ∈ {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: " 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 +""" diff --git a/ernie-fixed/Modelfile b/ernie-fixed/Modelfile new file mode 100644 index 0000000..8d60af3 --- /dev/null +++ b/ernie-fixed/Modelfile @@ -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 "" +PARAMETER num_predict 2048