Datasets:
File size: 984 Bytes
d847043 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """把训练数据、建表语句、假数据打包到 dist/,方便传 HF。"""
import shutil
from pathlib import Path
# 包里脚本在 scripts/,schemas/ data/ 在上一级;GitHub 仓库是平铺的,两种都认
ROOT = Path(__file__).resolve().parent
if not (ROOT / "schemas").is_dir():
ROOT = ROOT.parent
DIST = ROOT / "dist"
def main() -> None:
if DIST.exists():
shutil.rmtree(DIST)
(DIST / "schemas").mkdir(parents=True)
(DIST / "seeds").mkdir()
(DIST / "test").mkdir()
for p in (ROOT / "schemas").rglob("*.sql"):
shutil.copy2(p, DIST / "schemas" / p.name)
for p in (ROOT / "seeds").glob("*.sql"):
shutil.copy2(p, DIST / "seeds" / p.name)
for p in (ROOT / "data").glob("test_*.jsonl"):
shutil.copy2(p, DIST / "test" / p.name)
shutil.copy2(ROOT / "data" / "train.jsonl", DIST / "train.jsonl")
print("dist 好了:", len(list(DIST.rglob('*'))), "个文件")
if __name__ == "__main__":
main()
|