File size: 702 Bytes
15c46ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Package the explicit source allowlist, excluding credentials and model weights."""
import argparse
import zipfile
from pathlib import Path
from publish_space import ROOT, source_files

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--output", default=str(ROOT.parent / "nextgpt-chapter6-submission.zip"))
    args = parser.parse_args()
    target = Path(args.output).resolve()
    with zipfile.ZipFile(target, "w", compression=zipfile.ZIP_DEFLATED) as archive:
        for file in source_files():
            archive.write(file, "nextgpt-reproduction/" + file.relative_to(ROOT).as_posix())
    print(f"Created {target} ({target.stat().st_size:,} bytes)")