Vjeong Claude Opus 4.6 commited on
Commit
ae5f15e
Β·
1 Parent(s): a02e949

Add configurable wandb log directory path

Browse files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

llm_lab/config/train_config.py CHANGED
@@ -99,6 +99,8 @@ class TrainConfig:
99
  # ── wandb ──
100
  wandb_project: str = "llm-1b-lab"
101
  wandb_run_name: Optional[str] = None
 
 
102
  use_wandb: bool = True
103
 
104
  # ── Reproducibility ──
 
99
  # ── wandb ──
100
  wandb_project: str = "llm-1b-lab"
101
  wandb_run_name: Optional[str] = None
102
+ wandb_dir: Optional[str] = None
103
+ """Directory for wandb log files. Defaults to wandb's own default (usually ./wandb)."""
104
  use_wandb: bool = True
105
 
106
  # ── Reproducibility ──
llm_lab/training/metrics.py CHANGED
@@ -44,13 +44,16 @@ class MetricsTracker:
44
  import wandb
45
 
46
  run_id = resume_id or wandb.util.generate_id()
47
- self.wandb_run = wandb.init(
48
  project=self.config.wandb_project,
49
  name=self.config.wandb_run_name or f"1b-run-{run_id[:6]}",
50
  id=run_id,
51
  resume="allow",
52
  config=self.config.__dict__,
53
  )
 
 
 
54
  print(f"[wandb] Initialized: {self.wandb_run.url}")
55
  except ImportError:
56
  print("[wandb] Not installed. Using console logging only.")
 
44
  import wandb
45
 
46
  run_id = resume_id or wandb.util.generate_id()
47
+ init_kwargs = dict(
48
  project=self.config.wandb_project,
49
  name=self.config.wandb_run_name or f"1b-run-{run_id[:6]}",
50
  id=run_id,
51
  resume="allow",
52
  config=self.config.__dict__,
53
  )
54
+ if self.config.wandb_dir:
55
+ init_kwargs["dir"] = self.config.wandb_dir
56
+ self.wandb_run = wandb.init(**init_kwargs)
57
  print(f"[wandb] Initialized: {self.wandb_run.url}")
58
  except ImportError:
59
  print("[wandb] Not installed. Using console logging only.")
notebooks/03_training.ipynb CHANGED
@@ -78,7 +78,7 @@
78
  "execution_count": null,
79
  "metadata": {},
80
  "outputs": [],
81
- "source": "# --- λͺ¨λΈ μ„€μ • ---\nmodel_config = ModelConfig.debug_10m() # 검증 μ‹œ debug, μ‹€μ œ ν•™μŠ΅ μ‹œ base_1b()\n\n# --- 데이터 μ„€μ • ---\ndata_config = DataConfig(\n max_seq_len=model_config.max_seq_len,\n batch_size=4,\n)\n\n# --- ν•™μŠ΅ μ„€μ • ---\ntrain_config = TrainConfig.debug_10m() # 검증 μ‹œ debug, μ‹€μ œ ν•™μŠ΅ μ‹œ base_1b()\n\nprint(f\"Effective batch size: {train_config.effective_batch_size}\")\nprint(f\"Total steps: {train_config.total_steps:,}\")"
82
  },
83
  {
84
  "cell_type": "markdown",
 
78
  "execution_count": null,
79
  "metadata": {},
80
  "outputs": [],
81
+ "source": "# --- λͺ¨λΈ μ„€μ • ---\nmodel_config = ModelConfig.debug_10m() # 검증 μ‹œ debug, μ‹€μ œ ν•™μŠ΅ μ‹œ base_1b()\n\n# --- 데이터 μ„€μ • ---\ndata_config = DataConfig(\n max_seq_len=model_config.max_seq_len,\n batch_size=4,\n)\n\n# --- ν•™μŠ΅ μ„€μ • ---\ntrain_config = TrainConfig.debug_10m() # 검증 μ‹œ debug, μ‹€μ œ ν•™μŠ΅ μ‹œ base_1b()\ntrain_config.wandb_dir = \"/content/drive/MyDrive/wandb_logs\"\n\nprint(f\"Effective batch size: {train_config.effective_batch_size}\")\nprint(f\"Total steps: {train_config.total_steps:,}\")"
82
  },
83
  {
84
  "cell_type": "markdown",