walidsobhie-code Claude Opus 4.6 commited on
Commit
87ed83d
·
1 Parent(s): a075b90

fix: improve Kaggle notebook training

Browse files

- Fix training command for better output
- Add clear variable placeholders

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

Files changed (1) hide show
  1. notebooks/kaggle_128k_training.ipynb +10 -32
notebooks/kaggle_128k_training.ipynb CHANGED
@@ -43,14 +43,7 @@
43
  "execution_count": null,
44
  "metadata": {},
45
  "outputs": [],
46
- "source": [
47
- "import os\n",
48
- "from huggingface_hub import login\n",
49
- "\n",
50
- "# Add HF_TOKEN to Kaggle Secrets: https://www.kaggle.com/docs/secrets\n",
51
- "HF_TOKEN = \"YOUR_HF_TOKEN\" # ← Replace with your token (or use Kaggle Secrets)\n",
52
- "login(token=HF_TOKEN)"
53
- ]
54
  },
55
  {
56
  "cell_type": "markdown",
@@ -64,27 +57,7 @@
64
  "execution_count": null,
65
  "metadata": {},
66
  "outputs": [],
67
- "source": [
68
- "import subprocess, os\n",
69
- "os.chdir(\"/kaggle/working/stack-2.9\")\n",
70
- "\n",
71
- "env = dict(os.environ, HF_TOKEN=HF_TOKEN)\n",
72
- "\n",
73
- "result = subprocess.run([\n",
74
- " \"python3\", \"training/train_extended_context.py\",\n",
75
- " \"--model-path\", \"Qwen/Qwen2.5-Coder-1.5B\",\n",
76
- " \"--data-path\", \"training/training-data/tool_examples_combined.jsonl\",\n",
77
- " \"--output-dir\", \"/kaggle/working/stack-2.9-128k\",\n",
78
- " \"--context-length\", \"131072\",\n",
79
- " \"--lora-rank\", \"64\",\n",
80
- " \"--epochs\", \"3\",\n",
81
- " \"--push-to-hub\",\n",
82
- " \"--hub-model-id\", \"YOUR_USERNAME/stack-2.9-128k\" # ← Replace with your username\n",
83
- "], env=env, capture_output=True, text=True)\n",
84
- "\n",
85
- "print(\"STDOUT:\", result.stdout[-5000:] if result.stdout else \"None\")\n",
86
- "print(\"STDERR:\", result.stderr[-2000:] if result.stderr else \"None\")"
87
- ]
88
  },
89
  {
90
  "cell_type": "markdown",
@@ -109,8 +82,13 @@
109
  "accelerator": "GPU",
110
  "dataSources": [],
111
  "dockerImageVersion": "gpu",
112
- "gpuRequirements": { "top": "p100" },
113
- "kernelImage": { "id": "docker", "name": "docker" }
 
 
 
 
 
114
  },
115
  "kernelspec": {
116
  "display_name": "Python 3",
@@ -124,4 +102,4 @@
124
  },
125
  "nbformat": 4,
126
  "nbformat_minor": 4
127
- }
 
43
  "execution_count": null,
44
  "metadata": {},
45
  "outputs": [],
46
+ "source": "import os\nfrom huggingface_hub import login\n\n# Replace with your actual HF token\nHF_TOKEN = \"YOUR_HF_TOKEN\" # ← Replace with your token\nlogin(token=HF_TOKEN)\nprint(\"✓ Logged in to HuggingFace\")"
 
 
 
 
 
 
 
47
  },
48
  {
49
  "cell_type": "markdown",
 
57
  "execution_count": null,
58
  "metadata": {},
59
  "outputs": [],
60
+ "source": "import os\nos.chdir(\"/kaggle/working/stack-2.9\")\n\n# Training parameters - UPDATE THESE\nYOUR_HF_TOKEN = \"YOUR_HF_TOKEN\" # ← Replace with your HF token\nYOUR_USERNAME = \"your-username\" # ← Replace with your HF username\n\n# Run training\n!python training/train_extended_context.py \\\n --model-path Qwen/Qwen2.5-Coder-1.5B \\\n --data-path training/training-data/tool_examples_combined.jsonl \\\n --output-dir /kaggle/working/stack-2.9-128k \\\n --context-length 131072 \\\n --lora-rank 64 \\\n --epochs 3 \\\n --batch-size 1 \\\n --grad-accum 16 \\\n --push-to-hub \\\n --hub-model-id {YOUR_USERNAME}/stack-2.9-128k"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  },
62
  {
63
  "cell_type": "markdown",
 
82
  "accelerator": "GPU",
83
  "dataSources": [],
84
  "dockerImageVersion": "gpu",
85
+ "gpuRequirements": {
86
+ "top": "p100"
87
+ },
88
+ "kernelImage": {
89
+ "id": "docker",
90
+ "name": "docker"
91
+ }
92
  },
93
  "kernelspec": {
94
  "display_name": "Python 3",
 
102
  },
103
  "nbformat": 4,
104
  "nbformat_minor": 4
105
+ }