How to remove .ipynb checkpoint


(naveen manwani) #1

after running my model once .when i tried
data.val_y
i got this as a result array([1, 1, 1, 1, 1, 2, 2, 2, 2, 2])
and when i tried
data.classes
i got this result
[’.ipynb_checkpoints’, ‘idli’, ‘samosa’]

i manually removed .ipynb from my training set ,deleted whole dataset, then uploaded the dataset again
but still i encountered the same issue .does anybody know how to resolve it


Wiki: Lesson 1
Error with Dataset
Lesson 1 (Week 1) OSError: Is a directory
Part 1: OS Error
(Ramesh Sampath) #2

Your Jupyter Notebook might be inside the data folder. It needs to be outside of the data folder path. Jupyter will always create the .ipynb_checkpoints because it auto-saves notebooks. Move the Notebook and it should work fine.


AttributeError: 'NoneType' object has no attribute 'shape'
(naveen manwani) #3

i did
import os
print(os.getcwd())
/home/ubuntu/fastai/courses/dl1
so i guess my jupyter notebook is not inside data foder

and even when i moved my jupyter notebook,to /home/ubuntu/fastai/courses ,i faced an error which was module not found error i.e. no module name fastai
as you can clearly see my data folder and my file named thirdattempt are in the same directory


does this information helps


(naveen manwani) #4

what i learned till now by facing this issue is that
when you run a jupyter notebook, it automatically creates .ipynb_checkpoints class in the directory i’m currrently in
but when i ran dogbreed ,lesson1 all had the same cwd as my file which i’m having trouble with they didn’t had this issue
so,i’m little bit concerned why this file of mine has had this weird issue
can anyone look into my issue and help me in resolving it.


(Sanyam Bhutani) #5

It should work fine as long as you’re inside the fastai folder so that you can import the library and also as long as you’re not in the data directory (The path you’ve set up).


(naveen manwani) #6

i guess i’m not in data directory


(Sanyam Bhutani) #7

Did you remove the previously existing .ipynb files in the data directory?


(naveen manwani) #8

are you talking about model and tmp



i have sent step by step snapshot of my entire data folder


(Jeremy Howard) #9

Note that you need to use ls -a to see files and folders that have names starting with a period (.) .


(naveen manwani) #10

i did that i removed .ipynb checkpoint files from both of my training folders .but when i ran my notebook it appeared again


(Aditya) #11

Where exactly is your notebook located?

In our case we have it with all the other ones and access the data using the PATH Variable in all the notebooks…


(naveen manwani) #12

it’s located the same place where other notebook are there


(Gaurav Rele) #13

did you create a ipython notebook in your /data folder that you are using and then delete it? Like jeremy suggested you use use ls -l to check whether you have another file in the data directory where your folders “idli” and “samosa” are located.


(naveen manwani) #14

What I saw an ipynb checkpoint inside my training set of idli and valid set of samosa.even when i removed it manually and then i did
data.val_y
i got
[1,1,1,1,2,2,2,]
as the output


(Harry Coppock) #15

I am having this same issue for when I run my own image classifier. I also don’t have the notebook in the data folder however when I run ls -a it appears checkpoints are being created:

./ lesson3-rossman.ipynb
…/ lesson4-imdb.ipynb
adamw-sgdw-demo.ipynb lesson5-movielens.ipynb
cifar10.ipynb lesson6-rnn.ipynb
data@ lesson6-sgd.ipynb
embedding_refactoring_unit_tests.ipynb lesson7-CAM.ipynb
excel/ lesson7-cifar10.ipynb
fastai@ My attempt lesson 1.ipynb
fish.ipynb my_data/
images/ nasnet.ipynb
.ipynb_checkpoints/ nlp-arxiv.ipynb
keras_lesson1.ipynb nlp.ipynb
lang_model-arxiv.ipynb planet_cv.ipynb
lang_model.ipynb planet.py
lesson1.ipynb ppt/
lesson1-rxt50.ipynb rossman_exp.py
lesson1-vgg.ipynb scripts/
lesson2-image_models.ipynb test_transforms.ipynb

I’m not sure how to delete these checkpoints or how to stop them from forming as the only way I can think that they are forming is when the notebook is inside the data folder, which it isn’t I don’t think aha.


(Harry Coppock) #16

I think the issue may be with when I use the automatic image downloader posted in other threads? As I have no issues with running the image classifier code with manually downloaded images.


(Harry Coppock) #17

Although now if after I run the image classifier and then move some images from the training data into the validation data I again get the same error:

OSError: Is a directory: data/elephantsrhinos/train/elephant/.ipynb_checkpoints

Not sure why this would be? Any help would be greatly appreciated.


(Harry Coppock) #18

Oh I think I may have worked out why this is. I forgot to uncomment out:

shutil.rmtree(f'{PATH}tmp', ignore_errors=True)

Is this the reason? If it is I guess this deletes checkpoints created from previous attempts? A direct explanation would be greatly appreciated.

Thanks


(Aditya) #19

I don’t think so this is deleting the .ipynb directory as it mentions that it’s removing the TMP directory
We can do it manually using the notebook homepage via selecting those little check ones
or
use the terminal’s rm-f (warning it’s force remove , it will delete everything in that directory)


(Harry Coppock) #20

Thank you, I agree with you as unfortunately I am getting the same error again. Sorry, so you would suggest running rm -f in the cell before I run the new Image classifier?