|
|
@@ -1347,6 +1347,8 @@
|
|
|
],
|
|
|
"source": [
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
+ "from matplotlib.ticker import MaxNLocator\n",
|
|
|
+ "\n",
|
|
|
"\n",
|
|
|
"def plot_losses(epochs_seen, tokens_seen, train_losses, val_losses):\n",
|
|
|
" fig, ax1 = plt.subplots(figsize=(5, 3))\n",
|
|
|
@@ -1357,6 +1359,7 @@
|
|
|
" ax1.set_xlabel(\"Epochs\")\n",
|
|
|
" ax1.set_ylabel(\"Loss\")\n",
|
|
|
" ax1.legend(loc=\"upper right\")\n",
|
|
|
+ " ax1.xaxis.set_major_locator(MaxNLocator(integer=True)) # only show integer labels on x-axis\n",
|
|
|
"\n",
|
|
|
" # Create a second x-axis for tokens seen\n",
|
|
|
" ax2 = ax1.twiny() # Create a second x-axis that shares the same y-axis\n",
|
|
|
@@ -2455,7 +2458,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.10.6"
|
|
|
+ "version": "3.11.4"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|