File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ def extract_weights_from_checkpoint(fb0):
2727 with myzip .open (folder_name + f'/data/{ load_instruction .obj_key } ' ) as myfile :
2828 if (load_instruction .load_from_file_buffer (myfile )):
2929 torch_weights ['state_dict' ][sd_key ] = load_instruction .get_data ()
30- for sd_key ,special in special_instructions .items ():
31- torch_weights ['state_dict' ][sd_key ] = special
30+ if len (special_instructions ) > 0 :
31+ torch_weights ['state_dict' ]['_metadata' ] = {}
32+ for sd_key ,special in special_instructions .items ():
33+ torch_weights ['state_dict' ]['_metadata' ][sd_key ] = special
3234 return torch_weights
3335
3436def examine_pickle (fb0 ):
@@ -96,7 +98,7 @@ def parse_assign_line(self, line):
9698 del huge_mess
9799 assignments [- 1 ] = assignments [- 1 ].strip ('}' )
98100 re_var = re .compile ('^_var\d+$' )
99- assignment_count
101+ assignment_count = 0
100102 for a in assignments :
101103 if self ._add_assignment (a , re_var ):
102104 assignment_count = assignment_count + 1
You can’t perform that action at this time.
0 commit comments