heiyuheiyu commited on
Commit
b1ca020
·
verified ·
1 Parent(s): f4f675b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -5
Dockerfile CHANGED
@@ -129,13 +129,13 @@ def restore():
129
 
130
  # ── 方案 B:以 Dataset 中的 initialized.flag 作為觸發條件 ─────────────────
131
  # 邏輯:
132
- # - Dataset 中 initialized.flag → 首次部署 → 執行 restore,完成後寫入標記
133
- # - Dataset 中 initialized.flag → 普通 restart → 跳過 restore
134
  # - FORCE_RESTORE=true → 無視標記,強制執行 restore(用於 factory rebuild)
135
  #
136
  # Factory rebuild 場景的兩種觸發方式(任選其一):
137
  # 1. 在 HF Space Settings 中設置環境變量 FORCE_RESTORE=true,重建後再刪除此變量
138
- # 2. 直接在 HF Dataset 網頁上刪除 initialized.flag 文件,再點 Restart
139
  INIT_FLAG = "initialized.flag"
140
  force_restore = os.getenv("FORCE_RESTORE", "").strip().lower() in ("true", "1", "yes")
141
 
@@ -147,8 +147,8 @@ def restore():
147
 
148
  flag_exists = INIT_FLAG in all_files
149
 
150
- if flag_exists and not force_restore:
151
- print("Restore skip: initialized.flag found in Dataset, this is a normal restart.")
152
  return
153
 
154
  if force_restore:
 
129
 
130
  # ── 方案 B:以 Dataset 中的 initialized.flag 作為觸發條件 ─────────────────
131
  # 邏輯:
132
+ # - Dataset 中 initialized.flag → 普通 restart → 執行 restore,完成後寫入標記
133
+ # - Dataset 中 initialized.flag → 首次部署 → 跳過 restore
134
  # - FORCE_RESTORE=true → 無視標記,強制執行 restore(用於 factory rebuild)
135
  #
136
  # Factory rebuild 場景的兩種觸發方式(任選其一):
137
  # 1. 在 HF Space Settings 中設置環境變量 FORCE_RESTORE=true,重建後再刪除此變量
138
+ # 2. 直接在 HF Dataset 網頁上新建 initialized.flag 文件,再點 Restart
139
  INIT_FLAG = "initialized.flag"
140
  force_restore = os.getenv("FORCE_RESTORE", "").strip().lower() in ("true", "1", "yes")
141
 
 
147
 
148
  flag_exists = INIT_FLAG in all_files
149
 
150
+ if not flag_exists and not force_restore:
151
+ print("Restore skip: initialized.flag not found in Dataset, this is a normal restart.")
152
  return
153
 
154
  if force_restore: