Hi everyone. I try to implement the codes of each lesson in Google Colab.
But there are some codes that do not run in Google Colab and give errors. For example, I have given their photos below.
Hi @Mohammad_Fallah , have you copied other files public_tests.py and utils.py in the same folder in drive in which you are running your notebook?
If yes then, I think you need to install one more package, named ipympl. This is a thread which mentions about how to run notebooks on your local machine, I think this can help you in installing necessay package in google colab.
thanks a lot.
I downloaded the files according to the description. And I saved it in a folder on my computer. As you can see in the photo below.
One of the students said that you should paste the files in the path of your working folder.
And I also pasted these files in my folder in Google Drive.
I don’t see the error message from the screenshot in your first post of this topic. I assume the error was it couldn’t import libraries like lab_utils_common.
This could happen when your “current working directory” isn’t the directory that contains the library files. First please verify what your current working directory is by running this:
!pwd
And you can run the following to list all files under the current working directory
!ls
If you don’t see those library files, then you are not in the right directory, and you need to change the directory to the one that contains the library files by running
%cd path_to_the_correct_directory
Please replace path_to_the_correct_directory with the right path.
Hello my brother. I apologize for the delay in replying. The internet situation in my country is very bad.
In these few days, I tried different methods from YouTube and friends’ guidance. All of them were unsuccessful.
اBut specifically for the “C2_W1_Lab02_CoffeeRoasting_TF” lab, a very simple method was suggested that worked correctly and I have shown it in the photo below.
I just had to open a notebook file in the colab and then drag and drop these files into the colab as follows:
And the problem for this lesson was easily solved and the libraries were implemented. But I think there must be a better way. Because I had problems again in the next lessons and I still didn’t succeed in doing the next lessons in the colab.
What error message are you getting?
Did you make separate folders in Drive for uploading the downloaded files of different exercises? There may be files with same name in this different exercises, so you should made different folder for different exercises or optional labs.
Hello Brother.
The errors I encounter are usually about the absence of a specific library or module. Although I transfer all the files of each lesson to Google Drive, sometimes I encounter errors for some lessons.
I did not put the files in separate folders. I put everything in one space. From now on, I will try to create a separate folder for each lesson and check the result.
Just because the internet in my country disconnects and reconnects a lot and is weak and I am facing a challenge to be able to finish the courses and that is why I am replying late and I apologize for this.
Thank you for the description. Can you share a screenshot of the error message, and a screenshot of the result of running !pwd and !ls after you encounter the import errors?
Above are what I need to give you some suggestions.
In the next step, I executed the codes you told me to see “in which working path I am” and “what are the contents of the folder” and then “change the working path” and “check the contents of the folder” again. You can see the details of the codes in the picture below:
In the first photo, the 9th line is %matplotlib widget which is the same as the assignment file, however, in the second photo, the 9th line is get_python().run_line_magic('matplotlib', 'widget'). The second photo indicates that you were not running the code shown in the first photo.
Please run the code shown in the first photo. The first photo has the correct code for C2_W2_ReLU
If you cannot run through from autils import plt_act_trio, please comment it, and do not run plt_act_trio() in the next code cell. plt_act_trio() only shows you a linear, a sigmoid, and a ReLU function. You may watch the video for how they look, or just google their names.
if you run _ = plt_relu_ex() and nothing is shown. Run the following 2 lines, and then try again.
from google.colab import output
output.enable_custom_widget_manager()
if you still encounter a problem, again, please share a screenshot of the whole Error Traceback as you have done in the second photo.
A strange thing in the previous message is that line 9 is actually related to the execution of the code you saw in the first picture. I tried a few more times and there was no mistake. That error message is actually related to the execution of the code in the first image.
I see. Interesting. I think then I was wrong saying you had run a different line of code in my previous reply. You are running it on Colab, right? I tried running the code on a colab notebook as well but I didn’t have the error that you saw. I suggest you to try @Moaz_Elesawey’s advice, and if you can pass the 9th line, then please follow my suggestion number 2 to 4 in my last reply.
Cheers,
Raymond