Skip to content

Commit

Permalink
🐛 minor bug fixes and reformat (#182)
Browse files Browse the repository at this point in the history
* reformat

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
aniketmaurya and pre-commit-ci[bot] authored May 18, 2022
1 parent e339b1d commit 60ca633
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 18 deletions.
7 changes: 6 additions & 1 deletion examples/nbs/02-TextClassification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
"cell_type": "code",
"execution_count": null,
"id": "5fc8603f",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# download_data(\"https://pl-flash-data.s3.amazonaws.com/imdb.zip\", \"./data/\")\n",
Expand All @@ -59,6 +63,7 @@
" \"sentiment\",\n",
" train_file=\"data/imdb/train.csv\",\n",
" val_file=\"data/imdb/valid.csv\",\n",
" batch_size=4,\n",
")"
]
},
Expand Down
16 changes: 13 additions & 3 deletions examples/nbs/03-TextSummarization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
{
"cell_type": "markdown",
"metadata": {
"id": "xYgiH2TkkX7x"
"id": "xYgiH2TkkX7x",
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"<!--<badge>--><a href=\"https://colab.research.google.com/github/gradsflow/gradsflow/blob/main/examples/nbs/03-TextSummarization.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a><!--</badge>-->\n",
Expand All @@ -17,7 +20,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "2_posF7Rj8sH"
"id": "2_posF7Rj8sH",
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
Expand All @@ -34,14 +40,18 @@
" train_file=\"data/xsum/train.csv\",\n",
" val_file=\"data/xsum/valid.csv\",\n",
" test_file=\"data/xsum/test.csv\",\n",
" batch_size=4,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "YCYFfKhDkVVK"
"id": "YCYFfKhDkVVK",
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
Expand Down
40 changes: 30 additions & 10 deletions examples/nbs/04-RayDataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
{
"cell_type": "markdown",
"id": "9a226830",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"<!--<badge>--><a href=\"https://colab.research.google.com/github/gradsflow/gradsflow/blob/main/examples/nbs/04-RayDataset.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a><!--</badge>-->\n",
"\n",
Expand Down Expand Up @@ -40,7 +44,11 @@
"cell_type": "code",
"execution_count": null,
"id": "1fffc779",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"import os\n",
Expand All @@ -52,14 +60,15 @@
"cell_type": "code",
"execution_count": null,
"id": "1c550a6f",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"from torch.utils.data import DataLoader\n",
"from gradsflow import data\n",
"from gradsflow.data.image import (\n",
" RayImageFolder,\n",
" image_dataset_from_directory,\n",
" get_augmentations,\n",
")\n",
"from torchvision import transforms as T"
Expand All @@ -69,7 +78,11 @@
"cell_type": "code",
"execution_count": null,
"id": "ef8c7353",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stderr",
Expand All @@ -82,7 +95,6 @@
"source": [
"transforms = get_augmentations()\n",
"\n",
"\n",
"ds = RayImageFolder(\n",
" \"/Users/aniket/Pictures/data/train/\",\n",
" transforms,\n",
Expand All @@ -93,7 +105,11 @@
"cell_type": "code",
"execution_count": null,
"id": "c53a4e2f",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"iter_ds = iter(ds)"
Expand All @@ -103,7 +119,11 @@
"cell_type": "code",
"execution_count": null,
"id": "31ac27eb",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down
5 changes: 1 addition & 4 deletions examples/src/tasks/text_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

print("Creating datamodule...")
datamodule = TextClassificationData.from_csv(
"review",
"sentiment",
train_file="data/imdb/train.csv",
val_file="data/imdb/valid.csv",
"review", "sentiment", train_file="data/imdb/train.csv", val_file="data/imdb/valid.csv", batch_size=4
)

suggested_conf = dict(
Expand Down

0 comments on commit 60ca633

Please sign in to comment.