Upload build/publish_mix.py with huggingface_hub
Browse files- build/publish_mix.py +11 -0
build/publish_mix.py
CHANGED
|
@@ -171,6 +171,17 @@ def main():
|
|
| 171 |
p = os.path.join(a.root, extra)
|
| 172 |
if os.path.exists(p):
|
| 173 |
to_upload.append((extra, p))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
print(f"uploading {len(to_upload)} files to {a.repo}", flush=True)
|
| 175 |
if a.dry_run:
|
| 176 |
for np, lp in to_upload:
|
|
|
|
| 171 |
p = os.path.join(a.root, extra)
|
| 172 |
if os.path.exists(p):
|
| 173 |
to_upload.append((extra, p))
|
| 174 |
+
# The contamination masks are part of the mix's definition: without the exact exclusion set, replaying
|
| 175 |
+
# build_mix over the same staged sources produces a different -- less clean -- mix (§3.3, §3.12). They
|
| 176 |
+
# are ~1 byte per staged document, so shipping them costs ~1 MB.
|
| 177 |
+
fdir = os.path.join(a.root, "filter")
|
| 178 |
+
if man.get("contamination_filter") and os.path.isdir(fdir):
|
| 179 |
+
for name in sorted(os.listdir(fdir)):
|
| 180 |
+
to_upload.append((f"filter/{name}", os.path.join(fdir, name)))
|
| 181 |
+
elif man.get("contamination_filter"):
|
| 182 |
+
print("FATAL: manifest records a contamination filter but mixroot/filter/ is absent -- "
|
| 183 |
+
"this mix would be published unreproducible", flush=True)
|
| 184 |
+
sys.exit(9)
|
| 185 |
print(f"uploading {len(to_upload)} files to {a.repo}", flush=True)
|
| 186 |
if a.dry_run:
|
| 187 |
for np, lp in to_upload:
|