[GGUF] Support non-standard quant types with prefix (e.g. UD-IQ1_S) (#39471)

Signed-off-by: Injae Ryou <injaeryou@gmail.com>
Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
Injae Ryou
2026-04-10 07:22:53 +00:00
committed by GitHub
co-authored by Isotr0py
parent 65e4e46f66
commit 447ce22212
2 changed files with 65 additions and 3 deletions
+27
View File
@@ -81,6 +81,25 @@ class TestIsRemoteGGUF:
assert not is_remote_gguf("repo/model:INVALID_M")
assert not is_remote_gguf("repo/model:Q9_K_M")
def test_is_remote_gguf_nonstandard_quant_type(self):
"""Test is_remote_gguf with non-standard quant types containing
a known GGML type."""
# Non-standard quant types with known GGML type after prefix
assert is_remote_gguf("unsloth/Qwen3.5-35B-A3B-GGUF:UD-Q4_K_XL")
assert is_remote_gguf("user/Model:UD-Q4_K_M")
assert is_remote_gguf("user/SomeModel:Custom-Q8_0")
# Exact GGML type after prefix (no suffix stripping needed)
assert is_remote_gguf("user/Model-GGUF:UD-IQ4_NL")
assert is_remote_gguf("user/Model-GGUF:UD-Q8_0")
# Completely unknown quant types should still fail
assert not is_remote_gguf("repo/model:TOTALLY-RANDOM")
assert not is_remote_gguf("user/Model:UD-INVALID")
# No dash separator → not recognized as prefixed
assert not is_remote_gguf("repo/model:UDIQ4NL")
def test_is_remote_gguf_without_colon(self):
"""Test is_remote_gguf without colon."""
assert not is_remote_gguf("repo/model")
@@ -143,6 +162,14 @@ class TestSplitRemoteGGUF:
assert repo_id == "repo/model"
assert quant_type == "Q3_K_S"
def test_split_remote_gguf_nonstandard_quant_type(self):
"""Test split_remote_gguf with non-standard quant types in GGUF repos."""
repo_id, quant_type = split_remote_gguf(
"unsloth/Qwen3.5-35B-A3B-GGUF:UD-Q4_K_XL"
)
assert repo_id == "unsloth/Qwen3.5-35B-A3B-GGUF"
assert quant_type == "UD-Q4_K_XL"
def test_split_remote_gguf_with_path_object(self):
"""Test split_remote_gguf with Path object."""
repo_id, quant_type = split_remote_gguf(Path("unsloth/Qwen3-0.6B-GGUF:IQ1_S"))