Skip to content

Commit

Permalink
Base
Browse files Browse the repository at this point in the history
  • Loading branch information
kdhingra307 committed May 14, 2020
0 parents commit 90bd443
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions get_data.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"def clean_directory(label):\n",
" import os\n",
" assert label.split(\"/\")[0] == \"resources\" and \"..\" not in label\n",
" \n",
" try:\n",
" os.makedirs(label, exist_ok=False)\n",
" except FileExistsError as e:\n",
" print(\"Directory with path, {} already exists,\".format(label))\n",
" except Exception as e:\n",
" raise Exception"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"def get_mnist():\n",
" \n",
" from torchvision.datasets import MNIST\n",
" MNIST(\"resources/data/raw\", download=True)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Directory with path, resources/data/raw already exists,\n"
]
}
],
"source": [
"clean_directory(\"resources/data/raw\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 90bd443

Please sign in to comment.