I am not able to load the txt file. The code where its showing error is captions = readTextFile(‘C:\Users\Siddharth\Data\Flickr_TextData\Flickr8k.token.txt’)
captions = captions.split("\n")[:-1] it gives errorI tried adding r before the path also tried changing ‘’ into ‘/’. The code is running properly on jupyter but its not running on colab .I am not able to train my project because of this.Can you help me with it?
Error in loading the flickr8k.token.txt file in google colab and kaggle notebook
hey @Sid10 ,
can you let me know what exactly the error does it shows.
You can also share a screenshot of it .
Thank you .
"It show the error Unicode Error “unicodeescape” codec can’t decode bytes… Cannot open text files in Python 3 [duplicate] and when I add the r or change’’ into ‘/’ it shows cannot find file or directory but I copy paste the file path from typing the name on start and right click and copy file path so I don’t know how that error is coming also the same path works on Jupyter notebook
i guess you are working on colab , so the path would be different ?
I didn’t get you?The file path should be the same for both?
no . While working on colab, you work on different environment .
so the path is something like , /content/…something.
On the left panel you see on colab , right click on your file and click copy path.
It will give you the exact path to your file.
So it means I have to upload it on drive and then mount drive and give that path?
whenever we download any data on google colab .
like if we downloaded in a folder named images.
then path of that folder becomes /content/images/…
and if we use drive.
then it is something like , /content/drive/My Drive/…
So you need to paste this path , so that your code can understand the correct path to the file and use it properly.
So now how can i add the whole Image folder in the flickr8k dataset to the /content section of google colab?
you can use copy command written in bash and use it directly to work .
Like in colab use this command
!cp <source_path> <destination_path>
and if you are copying a folder or directory then use
!cp -r <source_folder_path> <destination_folder_path>