[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:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user