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):
27
27
with myzip .open (folder_name + f'/data/{ load_instruction .obj_key } ' ) as myfile :
28
28
if (load_instruction .load_from_file_buffer (myfile )):
29
29
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
32
34
return torch_weights
33
35
34
36
def examine_pickle (fb0 ):
@@ -96,7 +98,7 @@ def parse_assign_line(self, line):
96
98
del huge_mess
97
99
assignments [- 1 ] = assignments [- 1 ].strip ('}' )
98
100
re_var = re .compile ('^_var\d+$' )
99
- assignment_count
101
+ assignment_count = 0
100
102
for a in assignments :
101
103
if self ._add_assignment (a , re_var ):
102
104
assignment_count = assignment_count + 1
You can’t perform that action at this time.
0 commit comments