PowerMachine commited on
Commit
2a94ab3
·
verified ·
1 Parent(s): c9328c7

V6.5-7ds cleanup: remove legacy scripts/upload_v6_5_resilient.py

Browse files
Files changed (1) hide show
  1. scripts/upload_v6_5_resilient.py +0 -129
scripts/upload_v6_5_resilient.py DELETED
@@ -1,129 +0,0 @@
1
- """upload_v6_5_resilient.py — V6.5 upload to HuggingFace (single commit)."""
2
- from __future__ import annotations
3
- import json, os, sys, time, re
4
- from pathlib import Path
5
-
6
- PROJECT_ROOT = Path("/home/z/my-project")
7
- BIGRU_ROOT = PROJECT_ROOT / "BiGRU_T_version"
8
-
9
- CRITICAL_FILES_V65 = [
10
- "src/bigru_t/model/kohonen_learning_system.py",
11
- "src/bigru_t/model/__init__.py",
12
- "src/bigru_t/__init__.py",
13
- "src/bigru_t/model/hyp_t.py",
14
- "src/bigru_t/training/mtp.py",
15
- "src/bigru_t/training/ewc.py",
16
- "src/bigru_t/quantization/smoothquant_compressor.py",
17
- "src/bigru_t/model/vqvae2_hierarchical.py",
18
- "src/bigru_t/model/vqvae2_hierarchical_flexnet.py",
19
- "src/bigru_t/model/token_compress.py",
20
- "src/bigru_t/reasoning/thinking.py",
21
- "src/bigru_t/reasoning/reasoning_engine.py",
22
- "src/bigru_t/reasoning/circular_orchestration.py",
23
- "src/bigru_t/reasoning/tool_agent.py",
24
- "src/bigru_t/reasoning/distributed_reasoning_system.py",
25
- "src/bigru_t/reasoning/cyclic_reasoning.py",
26
- "src/bigru_t/reasoning/consensus_sampling.py",
27
- "v6_5_report.json",
28
- "v6_5_training_metrics.json",
29
- "v6_5_module_analysis.json",
30
- "v6_5_script_activity.json",
31
- "v6_5_ewc_w8a8_benchmark.json",
32
- "v6_5_reasoning_eval.json",
33
- "scripts/train_v6_5.py",
34
- "scripts/upload_v6_5_resilient.py",
35
- "src/bigru_t/utils/xeon_runtime.py",
36
- "src/bigru_t/data/streaming_datasets.py",
37
- ]
38
-
39
- def main() -> int:
40
- print("=" * 72)
41
- print("V6.5 — UPLOAD TO HUGGINGFACE")
42
- print("=" * 72)
43
- hf_token = os.environ.get("HF_TOKEN")
44
- if not hf_token:
45
- print("ERROR: HF_TOKEN not set in env")
46
- return 1
47
- print(f" HF_TOKEN loaded from env (length={len(hf_token)})")
48
-
49
- # Pre-upload safety: regex scrub any HF token format
50
- token_pattern = re.compile(r'hf_[A-Za-z0-9]{32,}')
51
- print("\n Pre-upload safety: scrubbing token from scripts...")
52
- for script_path in BIGRU_ROOT.glob("scripts/*.py"):
53
- try:
54
- content = script_path.read_text()
55
- if token_pattern.search(content):
56
- scrubbed = token_pattern.sub("hf_<REDACTED_TOKEN>", content)
57
- script_path.write_text(scrubbed)
58
- print(f" SCRUBBED: {script_path.name}")
59
- except Exception as e:
60
- print(f" SKIP {script_path.name}: {e}")
61
-
62
- try:
63
- from huggingface_hub import HfApi, upload_folder
64
- except ImportError:
65
- print("ERROR: huggingface_hub not installed")
66
- return 1
67
-
68
- api = HfApi(token=hf_token)
69
- repo_id = "PowerMachine/BiGRU_T_version"
70
- try:
71
- info = api.repo_info(repo_id=repo_id, repo_type="model")
72
- print(f" Repo: {repo_id} (existing, files={len(info.siblings)})")
73
- except Exception as e:
74
- print(f" ERROR: cannot access repo: {e}")
75
- return 1
76
-
77
- print(f"\n Uploading {BIGRU_ROOT} as single commit...")
78
- t0 = time.time()
79
- try:
80
- commit_info = upload_folder(
81
- repo_id=repo_id, repo_type="model",
82
- folder_path=str(BIGRU_ROOT),
83
- commit_message="V6.5-final: removed pre-V6.4 modules/scripts, moved kohonen_learning_system up, activated VQ-VAE-2 in pipeline, integrated reasoning_engine, benchmarked EWC+W8A8 dequant, exhausted 6 datasets",
84
- token=hf_token,
85
- )
86
- t1 = time.time()
87
- print(f" Upload completed in {t1 - t0:.2f}s")
88
- print(f" Commit: {commit_info.oid}")
89
- print(f" URL: https://huggingface.co/PowerMachine/BiGRU_T_version/commit/{commit_info.oid}")
90
- except Exception as e:
91
- print(f" ERROR: upload failed: {e}")
92
- return 1
93
-
94
- print("\n Verifying critical files in repo...")
95
- try:
96
- files_in_repo = api.list_repo_files(repo_id, repo_type="model")
97
- all_present = True
98
- for cf in CRITICAL_FILES_V65:
99
- present = cf in files_in_repo
100
- mark = "OK" if present else "MISS"
101
- print(f" [{mark}] {cf}")
102
- if not present:
103
- all_present = False
104
- print(f"\n Files in repo: {len(files_in_repo)}")
105
- if not all_present:
106
- print(" WARNING: some critical files missing!")
107
- except Exception as e:
108
- print(f" WARNING: cannot verify files: {e}")
109
-
110
- report = {
111
- "version": "V6.5",
112
- "upload_timestamp": time.strftime("%Y-%m-%dT%H:%M:%S"),
113
- "repo_id": repo_id,
114
- "commit_oid": commit_info.oid,
115
- "commit_url": f"https://huggingface.co/PowerMachine/BiGRU_T_version/commit/{commit_info.oid}",
116
- "duration_s": float(t1 - t0),
117
- "critical_files": CRITICAL_FILES_V65,
118
- "n_files_in_repo": len(files_in_repo) if "files_in_repo" in dir() else 0,
119
- }
120
- report_path = BIGRU_ROOT / "v6_5_upload_report.json"
121
- report_path.write_text(json.dumps(report, indent=2, ensure_ascii=False))
122
- print(f"\n Upload report: {report_path}")
123
- print("\n" + "=" * 72)
124
- print("V6.5 — UPLOAD COMPLETED")
125
- print("=" * 72)
126
- return 0
127
-
128
- if __name__ == "__main__":
129
- sys.exit(main())