Skip to content

Commit

Permalink
updates settings.init
Browse files Browse the repository at this point in the history
  • Loading branch information
m-gopichand committed Aug 20, 2024
1 parent 352518a commit d3930e7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5,214 deletions.
32 changes: 28 additions & 4 deletions nbs/04_learner.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "1b172ddd",
"metadata": {},
"outputs": [],
Expand All @@ -12,10 +12,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "7e8f8491",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'rapidai'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 12\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtorch\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m optim\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mtorch\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mnn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mfunctional\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mF\u001b[39;00m\n\u001b[0;32m---> 12\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrapidai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mconv\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfastprogress\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m progress_bar,master_bar\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'rapidai'"
]
}
],
"source": [
"#|export\n",
"import math,torch,matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -746,7 +758,7 @@
" order = MetricsCB.order+1\n",
" def __init__(self, plot=False): self.plot = plot\n",
" def before_fit(self, learn):\n",
" learn.epochs = self.mbar = master_bar(learn.epochs)\n",
" learn.epochs = self.mbar = master_bar(range(learn.epochs))\n",
" self.first = True\n",
" if hasattr(learn, 'metrics'): learn.metrics._log = self._log\n",
" self.losses = []\n",
Expand Down Expand Up @@ -1411,6 +1423,18 @@
"display_name": "python3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
41 changes: 0 additions & 41 deletions nbs/10_DDPM_v2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1213,39 +1213,6 @@
"learn.fit(epochs)"
]
},
{
"cell_type": "markdown",
"id": "95a1c653",
"metadata": {},
"source": [
"## A sneaky trick"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86695482",
"metadata": {},
"outputs": [],
"source": [
"class MultDL:\n",
" def __init__(self, dl, mult=2): self.dl,self.mult = dl,mult\n",
" def __len__(self): return len(self.dl)*self.mult\n",
" def __iter__(self):\n",
" for o in self.dl:\n",
" for i in range(self.mult): yield o"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "32255eaf",
"metadata": {},
"outputs": [],
"source": [
"dls.train = MultDL(dls.train)"
]
},
{
"cell_type": "markdown",
"id": "79413643",
Expand All @@ -1263,14 +1230,6 @@
"source": [
"import nbdev; nbdev.nbdev_export()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f63b979b",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit d3930e7

Please sign in to comment.