samcheng0 commited on
Commit
d1fa37b
Β·
verified Β·
1 Parent(s): 7dad53b

Upload train_tiny.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. train_tiny.py +8 -0
train_tiny.py CHANGED
@@ -228,6 +228,14 @@ def train():
228
  if "token_embed" in name or "lm_head" in name:
229
  param.requires_grad = True
230
 
 
 
 
 
 
 
 
 
231
  hf_repo = d_cfg.get("hf_repo")
232
  is_streaming = bool(hf_repo)
233
 
 
228
  if "token_embed" in name or "lm_head" in name:
229
  param.requires_grad = True
230
 
231
+ # ── torch.compile ──────────────────────────────────────────────────────
232
+ if t_cfg.get("compile", False):
233
+ try:
234
+ model = torch.compile(model, dynamic=True)
235
+ print("[Compile] torch.compile enabled (dynamic=True)")
236
+ except Exception as e:
237
+ print(f"[Compile] Failed: {e} β€” continuing without compile")
238
+
239
  hf_repo = d_cfg.get("hf_repo")
240
  is_streaming = bool(hf_repo)
241