GitHub Actions Claude Sonnet 4.6 commited on
Commit ·
c11a7a4
1
Parent(s): bd8587e
fix: patch DynamicCache.seen_tokens for MiniCPM3-4B compatibility
Browse filestransformers >= 4.47 removed DynamicCache.seen_tokens in favour of
get_seq_length(). MiniCPM3-4B's trust_remote_code modeling file still
calls .seen_tokens, causing AttributeError at generation time.
Adds the attribute back via setattr() at module import so the model's
generated code keeps working without modifying the model repo.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .claude/settings.json +4 -1
- hearthnet/services/llm/backends/hf_local.py +10 -0
- hearthnet/ui/__pycache__/app.cpython-313.pyc +0 -0
- hearthnet/ui/__pycache__/theme.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/ask.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/chat.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/emergency.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/files.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/getting_started.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/marketplace.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/mesh.cpython-313.pyc +0 -0
- hearthnet/ui/tabs/__pycache__/settings.cpython-313.pyc +0 -0
.claude/settings.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
| 1 |
{
|
| 2 |
"permissions": {
|
| 3 |
"allow": [
|
| 4 |
-
"Bash(xargs wc -l)"
|
|
|
|
|
|
|
|
|
|
| 5 |
]
|
| 6 |
}
|
| 7 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"permissions": {
|
| 3 |
"allow": [
|
| 4 |
+
"Bash(xargs wc -l)",
|
| 5 |
+
"Bash(git add *)",
|
| 6 |
+
"Bash(git commit -m ' *)",
|
| 7 |
+
"Bash(git push *)"
|
| 8 |
]
|
| 9 |
}
|
| 10 |
}
|
hearthnet/services/llm/backends/hf_local.py
CHANGED
|
@@ -23,6 +23,16 @@ from hearthnet.services.llm.tokenizers import model_family
|
|
| 23 |
|
| 24 |
_ON_HF_SPACE: bool = bool(os.getenv("SPACE_HOST"))
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
def _family(model_name: str) -> str:
|
| 28 |
return model_family(model_name)
|
|
|
|
| 23 |
|
| 24 |
_ON_HF_SPACE: bool = bool(os.getenv("SPACE_HOST"))
|
| 25 |
|
| 26 |
+
# MiniCPM3-4B (and other trust_remote_code models) call DynamicCache.seen_tokens,
|
| 27 |
+
# which was removed in transformers >= 4.47 in favour of get_seq_length().
|
| 28 |
+
# Patch it back transparently so the model's generated code keeps working.
|
| 29 |
+
try:
|
| 30 |
+
from transformers.cache_utils import DynamicCache as _DynCache
|
| 31 |
+
if not hasattr(_DynCache, "seen_tokens"):
|
| 32 |
+
setattr(_DynCache, "seen_tokens", property(lambda self: self._seen_tokens))
|
| 33 |
+
except Exception:
|
| 34 |
+
pass
|
| 35 |
+
|
| 36 |
|
| 37 |
def _family(model_name: str) -> str:
|
| 38 |
return model_family(model_name)
|
hearthnet/ui/__pycache__/app.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/__pycache__/app.cpython-313.pyc and b/hearthnet/ui/__pycache__/app.cpython-313.pyc differ
|
|
|
hearthnet/ui/__pycache__/theme.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/__pycache__/theme.cpython-313.pyc and b/hearthnet/ui/__pycache__/theme.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/ask.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/ask.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/ask.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/chat.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/chat.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/chat.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/emergency.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/emergency.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/emergency.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/files.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/files.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/files.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/getting_started.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/getting_started.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/getting_started.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/marketplace.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/marketplace.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/marketplace.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/mesh.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/mesh.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/mesh.cpython-313.pyc differ
|
|
|
hearthnet/ui/tabs/__pycache__/settings.cpython-313.pyc
CHANGED
|
Binary files a/hearthnet/ui/tabs/__pycache__/settings.cpython-313.pyc and b/hearthnet/ui/tabs/__pycache__/settings.cpython-313.pyc differ
|
|
|