@@ -232,7 +232,7 @@ def dump_markdown_metadata(reader: GGUFReader, args: argparse.Namespace) -> None
232
232
markdown_content += f'There is { len (reader .fields )} key/value pair(s) in this file\n '
233
233
markdown_content += '\n '
234
234
235
- kv_dump_table = []
235
+ kv_dump_table : list [ dict [ str , str | int ]] = []
236
236
for n , field in enumerate (reader .fields .values (), 1 ):
237
237
if not field .types :
238
238
pretty_type = 'N/A'
@@ -278,9 +278,9 @@ def dump_markdown_metadata(reader: GGUFReader, args: argparse.Namespace) -> None
278
278
279
279
if not args .no_tensors :
280
280
# Group tensors by their prefix and maintain order
281
- tensor_prefix_order = []
282
- tensor_name_to_key = {}
283
- tensor_groups = {}
281
+ tensor_prefix_order : list [ str ] = []
282
+ tensor_name_to_key : dict [ str , int ] = {}
283
+ tensor_groups : dict [ str , list [ ReaderTensor ]] = {}
284
284
total_elements = sum (tensor .n_elements for tensor in reader .tensors )
285
285
286
286
# Parsing Tensors Record
@@ -320,7 +320,7 @@ def dump_markdown_metadata(reader: GGUFReader, args: argparse.Namespace) -> None
320
320
markdown_content += f"### <a name=\" { group .replace ('.' , '_' )} \" >{ translate_tensor_name (group )} Tensor Group : { element_count_rounded_notation (group_elements )} Elements</a>\n \n "
321
321
322
322
# Precalculate pretty shape column sizing for visual consistency
323
- prettify_dimension_max_widths = {}
323
+ prettify_dimension_max_widths : dict [ int , int ] = {}
324
324
for tensor in tensors :
325
325
for i , dimension_size in enumerate (list (tensor .shape ) + [1 ] * (4 - len (tensor .shape ))):
326
326
if i in prettify_dimension_max_widths :
@@ -329,12 +329,12 @@ def dump_markdown_metadata(reader: GGUFReader, args: argparse.Namespace) -> None
329
329
prettify_dimension_max_widths [i ] = len (str (dimension_size ))
330
330
331
331
# Generate Tensor Layer Table Content
332
- tensor_dump_table = []
332
+ tensor_dump_table : list [ dict [ str , str | int ]] = []
333
333
for tensor in tensors :
334
334
human_friendly_name = translate_tensor_name (tensor .name .replace (".weight" , ".(W)" ).replace (".bias" , ".(B)" ))
335
- pretty_dimension = ' x ' .join (f'{ str (d ):^ {prettify_dimension_max_widths [i ]}} ' for i , d in enumerate (list (tensor .shape ) + [1 ] * (4 - len (tensor .shape ))))
336
- element_count_est = f"({ element_count_rounded_notation (tensor .n_elements ):>4 } )"
337
- element_count_string = f"{ element_count_est :>6 } { tensor .n_elements :^ 8} "
335
+ pretty_dimension = ' x ' .join (f'{ str (d ):> {prettify_dimension_max_widths [i ]}} ' for i , d in enumerate (list (tensor .shape ) + [1 ] * (4 - len (tensor .shape ))))
336
+ element_count_est = f"({ element_count_rounded_notation (tensor .n_elements ):>5 } )"
337
+ element_count_string = f"{ element_count_est } { tensor .n_elements :> 8} "
338
338
type_name_string = f"{ tensor .tensor_type .name } "
339
339
tensor_dump_table .append ({"t_id" :tensor_name_to_key [tensor .name ], "layer_name" :tensor .name , "human_layer_name" :human_friendly_name , "element_count" :element_count_string , "pretty_dimension" :pretty_dimension , "tensor_type" :type_name_string })
340
340
0 commit comments