File size: 436 Bytes
c7a413d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
import json

def reconstruct_file(index_file, output_file):
    with open(index_file, 'r') as f:
        shards = json.load(f)
    
    with open(output_file, 'wb') as output:
        for shard in shards:
            with open(shard, 'rb') as part:
                output.write(part.read())

index_file = 'model.safetensors.index.json'
output_file = 'reconstructed_model.safetensors'
reconstruct_file(index_file, output_file)