gguf-py : fix tensor groups for encoder-decoder models in gguf-dump.py (#8090)

Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
Co-authored-by: Brian <mofosyne@gmail.com>
This commit is contained in:
fairydreaming 2024-06-24 14:13:39 +02:00 committed by GitHub
parent 9a590c8226
commit d62e4aaa02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,7 +208,9 @@ def translate_tensor_name(name):
'ssm_d': 'State space model skip connection', 'ssm_d': 'State space model skip connection',
'ssm_dt': 'State space model time step', 'ssm_dt': 'State space model time step',
'ssm_out': 'State space model output projection', 'ssm_out': 'State space model output projection',
'blk': 'Block' 'blk': 'Block',
'enc': 'Encoder',
'dec': 'Decoder',
} }
expanded_words = [] expanded_words = []
@ -291,6 +293,10 @@ def dump_markdown_metadata(reader: GGUFReader, args: argparse.Namespace) -> None
tensor_group_name = "base" tensor_group_name = "base"
if tensor_components[0] == 'blk': if tensor_components[0] == 'blk':
tensor_group_name = f"{tensor_components[0]}.{tensor_components[1]}" tensor_group_name = f"{tensor_components[0]}.{tensor_components[1]}"
elif tensor_components[0] in ['enc', 'dec'] and tensor_components[1] == 'blk':
tensor_group_name = f"{tensor_components[0]}.{tensor_components[1]}.{tensor_components[2]}"
elif tensor_components[0] in ['enc', 'dec']:
tensor_group_name = f"{tensor_components[0]}"
# Check if new Tensor Group # Check if new Tensor Group
if tensor_group_name not in tensor_groups: if tensor_group_name not in tensor_groups: