add hack_utils with artifact_tools.py and refactor project one more time
This commit is contained in:
1 parent
7c922e4ffe
commit
6761d81353
12 files changed
+336
-24
No files matched your search
@@ -10,16 +10,18 @@ The directory structure of new project looks like this:
|
|||||||
│ │
|
│ │
|
||||||
│ ├── docs <- Useful pdf files
|
│ ├── docs <- Useful pdf files
|
||||||
│ │
|
│ │
|
||||||
|
│ ├── hack_utils <- Any extra scripts not belonging to training pipeline
|
||||||
|
│ │
|
||||||
│ ├── notebooks <- Jupyter notebooks
|
│ ├── notebooks <- Jupyter notebooks
|
||||||
│ │
|
│ │
|
||||||
│ ├── pipeline_modules <- All modules necessary for training deep learning models
|
│ ├── training_modules <- All modules necessary for training deep learning models
|
||||||
│ │ ├── callbacks.py <- Useful training callbacks
|
│ │ ├── callbacks.py <- Useful training callbacks
|
||||||
│ │ ├── data_modules.py <- "LightningDataModule" modules (wrappers for PyTorch "Dataset")
|
│ │ ├── data_modules.py <- "LightningDataModule" modules (wrappers for PyTorch "Dataset")
|
||||||
│ │ ├── datasets.py <- PyTorch "Dataset" modules
|
│ │ ├── datasets.py <- PyTorch "Dataset" modules
|
||||||
│ │ ├── lightning_wrapper.py <- Contains train/val/test step methods executed during training
|
│ │ ├── lightning_wrapper.py <- Contains train/val/test step methods executed during training
|
||||||
│ │ ├── logger_initializers.py <- Initializers for different loggers (wandb, tensorboard, etc.)
|
│ │ ├── loggers.py <- Initializers for different loggers (wandb, tensorboard, etc.)
|
||||||
│ │ ├── models.py <- Declarations of neural networks
|
│ │ ├── models.py <- Neural networks declarations
|
||||||
│ │ └── transforms.py <- Data transformations (preprocessing)
|
│ │ └── transforms.py <- Data transformations (data preprocessing)
|
||||||
│ │
|
│ │
|
||||||
│ ├── config.yaml <- Training configuration
|
│ ├── config.yaml <- Training configuration
|
||||||
│ ├── execute_sweep.py <- Special file for executing wandb sweeps (hyperparameter search)
|
│ ├── execute_sweep.py <- Special file for executing wandb sweeps (hyperparameter search)
|
||||||
@@ -71,7 +73,12 @@ Installation command generator: https://pytorch.org/get-started/locally/
|
|||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 7. PyCharm setup
|
#### 7. Log into your wandb account
|
||||||
|
```
|
||||||
|
wandb login
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 8. PyCharm setup
|
||||||
- open this repository as PyCharm project
|
- open this repository as PyCharm project
|
||||||
- set "hack_env" as project interpreter:<br>
|
- set "hack_env" as project interpreter:<br>
|
||||||
`Ctrl + Shift + A -> type "Project Interpreter"`
|
`Ctrl + Shift + A -> type "Project Interpreter"`
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import wandb
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def upload_artifact():
|
||||||
|
WANDB_PROJECT = "hackathon_template_test"
|
||||||
|
WANDB_TEAM = "kino"
|
||||||
|
FILES_TO_UPLOAD_PATH = "../data/skyhacks"
|
||||||
|
ARTIFACT_NAME = "skyhacks-dataset"
|
||||||
|
TYPE = "dataset" # type can be anything but we recommend sticking to "dataset" / "model" / "result"
|
||||||
|
|
||||||
|
# Set project which will own the artifact
|
||||||
|
os.mkdir("../logs") if not os.path.exists("../logs") else None
|
||||||
|
run = wandb.init(
|
||||||
|
project=WANDB_PROJECT,
|
||||||
|
entity=WANDB_TEAM,
|
||||||
|
dir="../logs",
|
||||||
|
name="artifact_upload",
|
||||||
|
job_type="artifact"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Recursively add all files from a directory
|
||||||
|
artifact = wandb.Artifact(
|
||||||
|
name=ARTIFACT_NAME,
|
||||||
|
type=TYPE
|
||||||
|
)
|
||||||
|
artifact.add_dir(FILES_TO_UPLOAD_PATH)
|
||||||
|
|
||||||
|
# Upload artifact
|
||||||
|
run.log_artifact(artifact, aliases=["latest"])
|
||||||
|
print("Files are being uploaded now...")
|
||||||
|
|
||||||
|
|
||||||
|
def download_artifact():
|
||||||
|
SAVE_DIR = "../data/skyhacks"
|
||||||
|
ARTIFACT = "kino/hackathon_template_test/skyhacks-dataset:v0"
|
||||||
|
|
||||||
|
# Choose what artifact you want to download
|
||||||
|
api = wandb.Api()
|
||||||
|
artifact = api.artifact(ARTIFACT)
|
||||||
|
|
||||||
|
# Download artifact
|
||||||
|
artifact.download(root=SAVE_DIR)
|
||||||
|
print("Files are being downloaded now...")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# upload_artifact()
|
||||||
|
download_artifact()
|
||||||
@@ -273,6 +273,253 @@
|
|||||||
" - Once cells are selected, you can then delete / copy / cut / paste / run them as a batch. This is helpful when you need to move parts of a notebook.\n",
|
" - Once cells are selected, you can then delete / copy / cut / paste / run them as a batch. This is helpful when you need to move parts of a notebook.\n",
|
||||||
" - You can also use Shift + M to merge multiple cells."
|
" - You can also use Shift + M to merge multiple cells."
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "<IPython.lib.display.YouTubeVideo at 0x29299a4f5c8>",
|
||||||
|
"text/html": "\n <iframe\n width=\"400\"\n height=\"300\"\n src=\"https://www.youtube.com/embed/ZbrRrXiWBKc\"\n frameborder=\"0\"\n allowfullscreen\n ></iframe>\n ",
|
||||||
|
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2MBERISGBUYLxoaL2NCOEJjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY//AABEIAWgB4AMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAQMCBAUGB//EAEgQAAECAgINBwoFAwUAAwAAAAABAgMRBAUSExchMVFSVJGSodHSFCIz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SKjXKqq1EvX0kvqMVo1FWGrFdEv+tEllez3lA2mUhj0m2lIqX/AFpflhLWq5yIrYyqi4FSRznUOiuVVdEiuVyKiqrU9c/Z7ym1FWjRbC2NsrBZtvLeAum+fSu2bhN/Wu2bjC3w54V0KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDOb+tds3Cb+tds3GFvh410KLfDxroUDZgqroLFcs1VEmpYV0foIfwoWAAAANZ3Su7TZNZ3Su7QNhvmp2EkN81OwkAAAAAA14/SM7F+xU+JDY9yOfJGrJVsfXKctCltJVEeyayvLf0FLrB6qrnNcqpKatav2AW+BOSRbJZtS8xVw4P3Ni0rlJoNdEYk5Oak1n5rcOgztq9cuzcBbaVyk0C0rlJoKravXLs3C2r1y7NwFtpXKTQLSuUmgqtq9cuzcLavXLs3AW2lcpNBXSEWDRosVFRVYxXSlhkhFtXrl2bjCKtthPhvjLYvarVwYF/QDn0SsYlJe6FEhsScJXTauD2bTpw/Mb2GjBoFHoqufDiPc6wViWTpyT2G4xzUYiKqIqIBmCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SASCLNuUgs25SAX0foIfwoWFcDoGfChYAAAA1ndK7tNk1ndK7tA2G+anYSQ3zU7CQAAAAADXpDUdEZNEW8uH9CtWQ0lNrEngmiFsfpWdi/Y1aRRm0iJDVzpNYizRPXNU3AXWpuQ3QLUycrBmg1eSRZtTlD5WMnLZunO/OWlOyRC0SO5JvpC2Stvq1VS/ztl9NAG3am5DdAtLerboNSJRY71mlIenPV02xFSaer1LKW02nMVY7YiRnI1EkrElJfaAtbMhugWtmQ3QZEgYWtmQ3QLWzIboMwBVEhsSG7mNwL6jCsqbHor2pBhWybVVfZ/28Wxeif8ACpr1qsS2stUZsNUbgc6U8IOrJtOjK1FVGoqpgkTy2L7ug5tlS0vrSoEvivLine truncated
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result",
|
||||||
|
"execution_count": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"from IPython.display import IFrame, HTML, YouTubeVideo\n",
|
||||||
|
"YouTubeVideo(\"ZbrRrXiWBKc\")"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from ipywidgets import FloatSlider, interactive, IntSlider"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def simple_ex(amplitude=2.0, phase=0.0):\n",
|
||||||
|
" x = np.linspace(-2*np.pi, 2*np.pi, 1000)\n",
|
||||||
|
" y = amplitude * np.sin(x + phase)\n",
|
||||||
|
" plt.rcParams['figure.figsize'] = 8,6\n",
|
||||||
|
" plt.figure()\n",
|
||||||
|
" plt.plot(x, y)\n",
|
||||||
|
" plt.xlim(-3, 3)\n",
|
||||||
|
" plt.ylim(-2*np.pi, 2*np.pi)\n",
|
||||||
|
"\n"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[1;32m<ipython-input-4-2d6992e82ad5>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mamplitude_slider\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mFloatSlider\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m2.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmin\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmax\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstep\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m.05\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mphase_slider\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mFloatSlider\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmin\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m-\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpi\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmax\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpi\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstep\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m.05\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m w = interactive(simple_ex,\n\u001b[0;32m 5\u001b[0m \u001b[0mamplitude\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mamplitude_slider\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;31mNameError\u001b[0m: name 'np' is not defined"
|
||||||
|
],
|
||||||
|
"ename": "NameError",
|
||||||
|
"evalue": "name 'np' is not defined",
|
||||||
|
"output_type": "error"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"amplitude_slider = FloatSlider(value=2.0, min=-10, max=10.0, step=.05)\n",
|
||||||
|
"phase_slider = FloatSlider(value=0.0, min=-np.pi, max=np.pi, step=.05)\n",
|
||||||
|
"\n",
|
||||||
|
"w = interactive(simple_ex,\n",
|
||||||
|
" amplitude=amplitude_slider,\n",
|
||||||
|
" phase=phase_slider\n",
|
||||||
|
" )"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[1;32m<ipython-input-7-633a1b7025a6>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mpandas\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mdata\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'loan_train.csv'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mpandas_profiling\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mreport\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpandas_profiling\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mProfileReport\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;32m~\\Anaconda3\\envs\\gdl\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36mread_csv\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)\u001b[0m\n\u001b[0;32m 686\u001b[0m )\n\u001b[0;32m 687\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 688\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m_read\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 689\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 690\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;32m~\\Anaconda3\\envs\\gdl\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m 452\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 453\u001b[0m \u001b[1;31m# Create the parser.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 454\u001b[1;33m \u001b[0mparser\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mTextFileReader\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfp_or_buf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 455\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 456\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mchunksize\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0miterator\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;32m~\\Anaconda3\\envs\\gdl\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[0;32m 946\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0moptions\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"has_index_names\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"has_index_names\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 947\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 948\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_make_engine\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mengine\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 949\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 950\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;32m~\\Anaconda3\\envs\\gdl\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m_make_engine\u001b[1;34m(self, engine)\u001b[0m\n\u001b[0;32m 1178\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_make_engine\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mengine\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"c\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1179\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mengine\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"c\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1180\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mCParserWrapper\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0moptions\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1181\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1182\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mengine\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"python\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;32m~\\Anaconda3\\envs\\gdl\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, src, **kwds)\u001b[0m\n\u001b[0;32m 2008\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"usecols\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0musecols\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2009\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2010\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_reader\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mparsers\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mTextReader\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msrc\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2011\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0munnamed_cols\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_reader\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0munnamed_cols\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2012\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[1;32mpandas\\_libs\\parsers.pyx\u001b[0m in \u001b[0;36mpandas._libs.parsers.TextReader.__cinit__\u001b[1;34m()\u001b[0m\n",
|
||||||
|
"\u001b[1;32mpandas\\_libs\\parsers.pyx\u001b[0m in \u001b[0;36mpandas._libs.parsers.TextReader._setup_parser_source\u001b[1;34m()\u001b[0m\n",
|
||||||
|
"\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'loan_train.csv'"
|
||||||
|
],
|
||||||
|
"ename": "FileNotFoundError",
|
||||||
|
"evalue": "[Errno 2] No such file or directory: 'loan_train.csv'",
|
||||||
|
"output_type": "error"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"data = pd.read_csv('loan_train.csv')\n",
|
||||||
|
"\n",
|
||||||
|
"import pandas_profiling\n",
|
||||||
|
"report = pandas_profiling.ProfileReport(data)\n",
|
||||||
|
"\n",
|
||||||
|
"report"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# print many outputs in the same cell!\n",
|
||||||
|
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||||
|
"InteractiveShell.ast_node_interactivity = \"all\"\n"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"text": [
|
||||||
|
"from IPython.display import IFrame, HTML, YouTubeVideo\n",
|
||||||
|
"YouTubeVideo(\"ZbrRrXiWBKc\")\n",
|
||||||
|
"from ipywidgets import FloatSlider, interactive, IntSlider\n",
|
||||||
|
"def simple_ex(amplitude=2.0, phase=0.0):\n",
|
||||||
|
" x = np.linspace(-2*np.pi, 2*np.pi, 1000)\n",
|
||||||
|
" y = amplitude * np.sin(x + phase)\n",
|
||||||
|
" plt.rcParams['figure.figsize'] = 8,6\n",
|
||||||
|
" plt.figure()\n",
|
||||||
|
" plt.plot(x, y)\n",
|
||||||
|
" plt.xlim(-3, 3)\n",
|
||||||
|
" plt.ylim(-2*np.pi, 2*np.pi)\n",
|
||||||
|
"amplitude_slider = FloatSlider(value=2.0, min=-10, max=10.0, step=.05)\n",
|
||||||
|
"phase_slider = FloatSlider(value=0.0, min=-np.pi, max=np.pi, step=.05)\n",
|
||||||
|
"\n",
|
||||||
|
"w = interactive(simple_ex,\n",
|
||||||
|
" amplitude=amplitude_slider,\n",
|
||||||
|
" phase=phase_slider\n",
|
||||||
|
" )\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"data = pd.read_csv('loan_train.csv')\n",
|
||||||
|
"\n",
|
||||||
|
"import pandas_profiling\n",
|
||||||
|
"report = pandas_profiling.ProfileReport(data)\n",
|
||||||
|
"\n",
|
||||||
|
"report\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"data = pd.read_csv('loan_train.csv')\n",
|
||||||
|
"\n",
|
||||||
|
"import pandas_profiling\n",
|
||||||
|
"report = pandas_profiling.ProfileReport(data)\n",
|
||||||
|
"\n",
|
||||||
|
"report\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"data = pd.read_csv('loan_train.csv')\n",
|
||||||
|
"\n",
|
||||||
|
"import pandas_profiling\n",
|
||||||
|
"report = pandas_profiling.ProfileReport(data)\n",
|
||||||
|
"\n",
|
||||||
|
"report\n",
|
||||||
|
"# print many outputs in the same cell!\n",
|
||||||
|
"from IPython.core.interactiveshell import InteractiveShell\n",
|
||||||
|
"InteractiveShell.ast_node_interactivity = \"all\"\n",
|
||||||
|
"get_ipython().run_line_magic('history', '-t')\n"
|
||||||
|
],
|
||||||
|
"output_type": "stream"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%history -t"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"source": [
|
||||||
|
"https://towardsdatascience.com/bringing-the-best-out-of-jupyter-notebooks-for-data-science-f0871519ca29"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%% md\n",
|
||||||
|
"is_executing": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"\n"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"pycharm": {
|
||||||
|
"name": "#%%\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@@ -296,10 +543,10 @@
|
|||||||
"pycharm": {
|
"pycharm": {
|
||||||
"stem_cell": {
|
"stem_cell": {
|
||||||
"cell_type": "raw",
|
"cell_type": "raw",
|
||||||
|
"source": [],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
}
|
||||||
"source": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+6
-3
@@ -1,5 +1,5 @@
|
|||||||
from pipeline_modules.lightning_wrapper import LitModel
|
from training_modules.lightning_wrapper import LitModel
|
||||||
from pipeline_modules import transforms
|
from training_modules import transforms
|
||||||
import pytorch_lightning as pl
|
import pytorch_lightning as pl
|
||||||
from train import load_config
|
from train import load_config
|
||||||
import torch
|
import torch
|
||||||
@@ -25,7 +25,10 @@ def predict():
|
|||||||
print(output)
|
print(output)
|
||||||
|
|
||||||
|
|
||||||
def download_from_wanb():
|
def download_from_wandb():
|
||||||
|
"""
|
||||||
|
WARNING: This will overwrite your models.py, lightning_wrapper.py and config.yaml files!
|
||||||
|
"""
|
||||||
MODEL_PATH = ""
|
MODEL_PATH = ""
|
||||||
CODE_PATH = ""
|
CODE_PATH = ""
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -3,10 +3,10 @@ from pytorch_lightning.profiler import SimpleProfiler
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
# custom
|
# custom
|
||||||
from pipeline_modules.lightning_wrapper import LitModel
|
from training_modules.lightning_wrapper import LitModel
|
||||||
from pipeline_modules.logger_initializers import *
|
from training_modules.loggers import *
|
||||||
from pipeline_modules.data_modules import *
|
from training_modules.data_modules import *
|
||||||
from pipeline_modules.callbacks import *
|
from training_modules.callbacks import *
|
||||||
|
|
||||||
|
|
||||||
def train(config):
|
def train(config):
|
||||||
@@ -21,8 +21,8 @@ def train(config):
|
|||||||
# Init our model
|
# Init our model
|
||||||
model = LitModel(hparams=config["hparams"])
|
model = LitModel(hparams=config["hparams"])
|
||||||
|
|
||||||
# Init wandb logger
|
# Init experiment logger
|
||||||
wandb_logger = init_wandb(config, model, datamodule)
|
logger = get_wandb_logger(config, model, datamodule)
|
||||||
|
|
||||||
# Init callbacks
|
# Init callbacks
|
||||||
callbacks = [
|
callbacks = [
|
||||||
@@ -45,7 +45,7 @@ def train(config):
|
|||||||
|
|
||||||
# Init trainer
|
# Init trainer
|
||||||
trainer = pl.Trainer(
|
trainer = pl.Trainer(
|
||||||
logger=wandb_logger,
|
logger=logger,
|
||||||
callbacks=callbacks,
|
callbacks=callbacks,
|
||||||
gpus=config["num_of_gpus"],
|
gpus=config["num_of_gpus"],
|
||||||
max_epochs=config["hparams"]["max_epochs"],
|
max_epochs=config["hparams"]["max_epochs"],
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class ExampleCallback(pl.Callback):
|
|||||||
class SaveModelOnnxCallback(pl.Callback):
|
class SaveModelOnnxCallback(pl.Callback):
|
||||||
"""
|
"""
|
||||||
Save model in .onnx format.
|
Save model in .onnx format.
|
||||||
|
Might crash since not all models are compatible with onnx.
|
||||||
"""
|
"""
|
||||||
def __init__(self, datamodule, save_dir):
|
def __init__(self, datamodule, save_dir):
|
||||||
first_batch = next(iter(datamodule.train_dataloader()))
|
first_batch = next(iter(datamodule.train_dataloader()))
|
||||||
@@ -5,8 +5,8 @@ import pytorch_lightning as pl
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
# custom
|
# custom
|
||||||
from pipeline_modules.transforms import *
|
from training_modules.transforms import *
|
||||||
from pipeline_modules.datasets import *
|
from training_modules.datasets import *
|
||||||
|
|
||||||
|
|
||||||
class ExampleDataModule(pl.LightningDataModule):
|
class ExampleDataModule(pl.LightningDataModule):
|
||||||
File renamed without changes.
+1
-1
@@ -5,7 +5,7 @@ import torch.nn.functional as F
|
|||||||
import pytorch_lightning as pl
|
import pytorch_lightning as pl
|
||||||
|
|
||||||
# custom models
|
# custom models
|
||||||
from pipeline_modules.models import *
|
from training_modules.models import *
|
||||||
|
|
||||||
|
|
||||||
class LitModel(pl.LightningModule):
|
class LitModel(pl.LightningModule):
|
||||||
+6
-1
@@ -2,7 +2,7 @@ from pytorch_lightning.loggers import WandbLogger, TensorBoardLogger, CometLogge
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def init_wandb(config, lit_model, datamodule):
|
def get_wandb_logger(config, lit_model, datamodule):
|
||||||
wandb_logger = WandbLogger(
|
wandb_logger = WandbLogger(
|
||||||
project=config["loggers"]["wandb"]["project"],
|
project=config["loggers"]["wandb"]["project"],
|
||||||
job_type=config["loggers"]["wandb"]["job_type"],
|
job_type=config["loggers"]["wandb"]["job_type"],
|
||||||
@@ -28,3 +28,8 @@ def init_wandb(config, lit_model, datamodule):
|
|||||||
# download model from a specific wandb run
|
# download model from a specific wandb run
|
||||||
# wandb.restore('model-best.h5', run_path="kino/some_project/a1b2c3d")
|
# wandb.restore('model-best.h5', run_path="kino/some_project/a1b2c3d")
|
||||||
return wandb_logger
|
return wandb_logger
|
||||||
|
|
||||||
|
|
||||||
|
def get_tensorboard_loggger():
|
||||||
|
"""TODO"""
|
||||||
|
return None
|
||||||
@@ -116,7 +116,7 @@ class ResnextPretrained(nn.Module):
|
|||||||
return self.model(x)
|
return self.model(x)
|
||||||
|
|
||||||
|
|
||||||
# this model doesn't work yet, we wait for lightinng-bolts patch
|
# this model doesn't work yet, we wait for lightning-bolts patch
|
||||||
# class ResnetPretrainedUnsupervised(nn.Module):
|
# class ResnetPretrainedUnsupervised(nn.Module):
|
||||||
# """
|
# """
|
||||||
# Trained without labels on Imagenet.
|
# Trained without labels on Imagenet.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
from torchvision import transforms
|
from torchvision import transforms
|
||||||
|
|
||||||
|
|
||||||
data_augmentation_transformations = [
|
img_augmentation_transformations = [
|
||||||
transforms.RandomAffine((-15, 15), translate=(0.2, 0.2)),
|
transforms.RandomAffine((-15, 15), translate=(0.2, 0.2)),
|
||||||
transforms.RandomHorizontalFlip(p=0.65),
|
transforms.RandomHorizontalFlip(p=0.65),
|
||||||
transforms.RandomRotation((-15, 15)),
|
transforms.RandomRotation((-15, 15)),
|
||||||
@@ -12,7 +12,7 @@ efficient_net_train_preprocess = transforms.Compose([
|
|||||||
transforms.Resize((256, 256)), # the correct size for eff net b1 is 224x224 but we random crop it later
|
transforms.Resize((256, 256)), # the correct size for eff net b1 is 224x224 but we random crop it later
|
||||||
transforms.RandomCrop(224),
|
transforms.RandomCrop(224),
|
||||||
transforms.ToTensor(),
|
transforms.ToTensor(),
|
||||||
transforms.RandomApply(data_augmentation_transformations, 0.8),
|
transforms.RandomApply(img_augmentation_transformations, 0.8),
|
||||||
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
||||||
])
|
])
|
||||||
|
|
||||||
Reference in new issue
Block a user