diff --git a/gguf-py/gguf/metadata.py b/gguf-py/gguf/metadata.py index 0cfaf80aa..7d6478189 100644 --- a/gguf-py/gguf/metadata.py +++ b/gguf-py/gguf/metadata.py @@ -179,7 +179,7 @@ class Metadata: # Heuristic to match against cases such as 'Mixtral-8x7B-Instruct-v0.1' or 'Codestral-22B-v0.1' regex_match = re.compile(r'^' r'(?P[A-Za-z0-9\s]*(?:(?:-(?:(?:[A-Za-z\s][A-Za-z0-9\s]*)|(?:[0-9\s]*)))*))' - r'(?:-(?P(?:\d+x)?\d+[A-Za-z](?:-[A-Za-z]+(?:\d+x)?\d+[A-Za-z]+)?)(?:-(?P[A-Za-z0-9\s-]+))?)?' + r'(?:-(?P(?:\d+x)?(\d+\.)?\d+[A-Za-z](?:-[A-Za-z]+(\d+\.)?\d+[A-Za-z]+)?)(?:-(?P[A-Za-z0-9\s-]+))?)?' r'(?:-(?Pv\d+(?:\.\d+)*))?' r'$').match(model_full_name_component) diff --git a/gguf-py/tests/test_metadata.py b/gguf-py/tests/test_metadata.py index 340b1b493..2c25e85d4 100755 --- a/gguf-py/tests/test_metadata.py +++ b/gguf-py/tests/test_metadata.py @@ -73,6 +73,10 @@ class TestMetadataMethod(unittest.TestCase): self.assertEqual(gguf.Metadata.get_model_id_components("crestf411/daybreak-kunoichi-2dpo-7b"), ('daybreak-kunoichi-2dpo-7b', 'crestf411', None, None, None, None)) + # This is a real model id where the weight size has a decimal point + self.assertEqual(gguf.Metadata.get_model_id_components("Qwen2-0.5B-Instruct"), + ('Qwen2-0.5B-Instruct', None, 'Qwen2', 'Instruct', None, '0.5B')) + def test_apply_metadata_heuristic_from_model_card(self): model_card = { 'tags': ['Llama-3', 'instruct', 'finetune', 'chatml', 'DPO', 'RLHF', 'gpt4', 'synthetic data', 'distillation', 'function calling', 'json mode', 'axolotl'],