HoangTrungNguyen commited on
Commit
6b2d0fe
·
verified ·
1 Parent(s): 9dd9495

Upload HUGGINGFACE.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. HUGGINGFACE.md +117 -0
HUGGINGFACE.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Data/Code Split Workflow
2
+
3
+ Use two Hugging Face repos:
4
+
5
+ - **Data repo**: Dataset repo, e.g. `YOUR_USERNAME/decode-iblend-data`
6
+ - **Code repo**: Model repo by default, e.g. `YOUR_USERNAME/decode-iblend-code`
7
+
8
+ This keeps the large CSV data separate from the notebook/script code.
9
+
10
+ ## 1. Upload From This Machine
11
+
12
+ ```bash
13
+ python3 -m pip install huggingface_hub
14
+ export HF_TOKEN=hf_your_token_here
15
+
16
+ python3 scripts/upload_to_huggingface.py \
17
+ --data-repo-id YOUR_USERNAME/decode-iblend-data \
18
+ --code-repo-id YOUR_USERNAME/decode-iblend-code
19
+ ```
20
+
21
+ Optional private repos:
22
+
23
+ ```bash
24
+ python3 scripts/upload_to_huggingface.py \
25
+ --data-repo-id YOUR_USERNAME/decode-iblend-data \
26
+ --code-repo-id YOUR_USERNAME/decode-iblend-code \
27
+ --private
28
+ ```
29
+
30
+ Dry run:
31
+
32
+ ```bash
33
+ python3 scripts/upload_to_huggingface.py \
34
+ --data-repo-id YOUR_USERNAME/decode-iblend-data \
35
+ --code-repo-id YOUR_USERNAME/decode-iblend-code \
36
+ --dry-run
37
+ ```
38
+
39
+ If you also want the code repo to be a Dataset repo:
40
+
41
+ ```bash
42
+ python3 scripts/upload_to_huggingface.py \
43
+ --data-repo-id YOUR_USERNAME/decode-iblend-data \
44
+ --code-repo-id YOUR_USERNAME/decode-iblend-code \
45
+ --code-repo-type dataset
46
+ ```
47
+
48
+ ## 2. Download Data And Code In A Fresh Notebook
49
+
50
+ ```python
51
+ %pip install -q huggingface_hub
52
+
53
+ from huggingface_hub import snapshot_download
54
+ from pathlib import Path
55
+ import os
56
+
57
+ HF_DATA_REPO_ID = "YOUR_USERNAME/decode-iblend-data"
58
+ HF_CODE_REPO_ID = "YOUR_USERNAME/decode-iblend-code"
59
+ CODE_REPO_TYPE = "model" # change to "dataset" if you uploaded code as a dataset repo
60
+
61
+ DATA_DIR = Path("hf_data")
62
+ CODE_DIR = Path("hf_code")
63
+
64
+ snapshot_download(
65
+ repo_id=HF_DATA_REPO_ID,
66
+ repo_type="dataset",
67
+ local_dir=str(DATA_DIR),
68
+ local_dir_use_symlinks=False,
69
+ )
70
+
71
+ snapshot_download(
72
+ repo_id=HF_CODE_REPO_ID,
73
+ repo_type=CODE_REPO_TYPE,
74
+ local_dir=str(CODE_DIR),
75
+ local_dir_use_symlinks=False,
76
+ )
77
+
78
+ os.environ["IBLEND_DATA_ROOT"] = str(DATA_DIR.resolve())
79
+ SCRIPT_PATH = str((CODE_DIR / "scripts" / "decode_reimplementation.py").resolve())
80
+
81
+ print("Data root:", os.environ["IBLEND_DATA_ROOT"])
82
+ print("Script:", SCRIPT_PATH)
83
+ ```
84
+
85
+ Then run immediately in the same notebook:
86
+
87
+ ```python
88
+ %run $SCRIPT_PATH --mode paper_buildings --target Academic --test-span-days 7 --skip-lstm
89
+ ```
90
+
91
+ For deep learning:
92
+
93
+ ```python
94
+ %run $SCRIPT_PATH --mode paper_buildings --target Academic --test-span-days 7 --dl-models lstm,cnn,tcn --epochs 20 --batch-size 64
95
+ ```
96
+
97
+ ## Data Repo Layout
98
+
99
+ ```text
100
+ energy_dataset/
101
+ IIITD_occupancy_dataset/
102
+ iiitd_calender_schedule/
103
+ weather_comparison/
104
+ ```
105
+
106
+ ## Code Repo Layout
107
+
108
+ ```text
109
+ DECODE_Reimplementation.ipynb
110
+ HUGGINGFACE.md
111
+ scripts/decode_reimplementation.py
112
+ scripts/upload_to_huggingface.py
113
+ scripts/preprocess_and_eda_by_building.py
114
+ decode_reimplementation_outputs/README.md
115
+ ```
116
+
117
+ `decode_reimplementation.py` reads data from `IBLEND_DATA_ROOT`, so code and data can live in separate folders.