Mehdi commited on
Commit ·
5ad43b3
1
Parent(s): 7458c71
feat: upgrade to MiniCPM4.1-8B + official GGUF, disable thinking mode
Browse files- DEFAULT_MODEL_ID → openbmb/MiniCPM4.1-8B
- DEFAULT_GGUF_REPO → openbmb/MiniCPM4.1-8B-GGUF
- enable_thinking=False in apply_chat_template to suppress chain-of-thought
tokens and keep structured question/evaluation outputs clean
- transformers==4.57.1 satisfies the new >=4.56 requirement, no pin change needed
- model/llm.py +6 -7
model/llm.py
CHANGED
|
@@ -7,10 +7,8 @@ Responsibility:
|
|
| 7 |
about the underlying model loading or tokenisation details.
|
| 8 |
|
| 9 |
Model choice:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
with the production prompt so it is optimized for exam-question
|
| 13 |
-
generation over course material. Requires transformers >= 4.50.0.
|
| 14 |
|
| 15 |
Environment variables:
|
| 16 |
PAPERPROF_MODEL Override the default model ID (e.g. "openbmb/MiniCPM3-4B"
|
|
@@ -32,7 +30,7 @@ import torch
|
|
| 32 |
from functools import lru_cache
|
| 33 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, BitsAndBytesConfig
|
| 34 |
|
| 35 |
-
DEFAULT_MODEL_ID = "
|
| 36 |
DEFAULT_MAX_NEW_TOKENS = 512
|
| 37 |
|
| 38 |
# Pre-load libnvJitLink.so.13 bundled with the nvidia-cu13 wheel so that
|
|
@@ -95,7 +93,8 @@ class LLM:
|
|
| 95 |
"""Run *prompt* through the model and return the generated text only."""
|
| 96 |
messages = [{"role": "user", "content": prompt}]
|
| 97 |
text = self._tokenizer.apply_chat_template(
|
| 98 |
-
messages, tokenize=False, add_generation_prompt=True
|
|
|
|
| 99 |
)
|
| 100 |
output = self._pipe(
|
| 101 |
text,
|
|
@@ -106,7 +105,7 @@ class LLM:
|
|
| 106 |
return output[0]["generated_text"]
|
| 107 |
|
| 108 |
|
| 109 |
-
DEFAULT_GGUF_REPO = "
|
| 110 |
|
| 111 |
|
| 112 |
class LlamaCppLLM:
|
|
|
|
| 7 |
about the underlying model loading or tokenisation details.
|
| 8 |
|
| 9 |
Model choice:
|
| 10 |
+
openbmb/MiniCPM4.1-8B — base model, thinking mode disabled for fast
|
| 11 |
+
structured outputs. Requires transformers >= 4.56.
|
|
|
|
|
|
|
| 12 |
|
| 13 |
Environment variables:
|
| 14 |
PAPERPROF_MODEL Override the default model ID (e.g. "openbmb/MiniCPM3-4B"
|
|
|
|
| 30 |
from functools import lru_cache
|
| 31 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, BitsAndBytesConfig
|
| 32 |
|
| 33 |
+
DEFAULT_MODEL_ID = "openbmb/MiniCPM4.1-8B"
|
| 34 |
DEFAULT_MAX_NEW_TOKENS = 512
|
| 35 |
|
| 36 |
# Pre-load libnvJitLink.so.13 bundled with the nvidia-cu13 wheel so that
|
|
|
|
| 93 |
"""Run *prompt* through the model and return the generated text only."""
|
| 94 |
messages = [{"role": "user", "content": prompt}]
|
| 95 |
text = self._tokenizer.apply_chat_template(
|
| 96 |
+
messages, tokenize=False, add_generation_prompt=True,
|
| 97 |
+
enable_thinking=False,
|
| 98 |
)
|
| 99 |
output = self._pipe(
|
| 100 |
text,
|
|
|
|
| 105 |
return output[0]["generated_text"]
|
| 106 |
|
| 107 |
|
| 108 |
+
DEFAULT_GGUF_REPO = "openbmb/MiniCPM4.1-8B-GGUF"
|
| 109 |
|
| 110 |
|
| 111 |
class LlamaCppLLM:
|