natural-language-processing icon indicating copy to clipboard operation
natural-language-processing copied to clipboard

NotImplementedError: Open utils.py and fill with your code. In case of Google Colab, download(https://github.com/hse-aml/natural-language-processing/blob/master/project/utils.py), edit locally and upload using '> arrow on the left edge' -> Files -> UPLOAD

Open ayushmandloi2 opened this issue 6 years ago • 28 comments

ayushmandloi2 avatar Oct 07 '18 11:10 ayushmandloi2

i have edited and uploaded the utils.py file. coursera

ayushmandloi2 avatar Oct 07 '18 11:10 ayushmandloi2

Try running ! shred utils.py and re-upload your file! It looks like a caching bug in Google Colab.

ZEMUSHKA avatar Oct 07 '18 11:10 ZEMUSHKA

And you also need to restart the kernel to import the new version of the file!

ZEMUSHKA avatar Oct 07 '18 11:10 ZEMUSHKA

issue not solved yet i tried what you told. coursera2

ayushmandloi2 avatar Oct 07 '18 12:10 ayushmandloi2

That means that you haven't implemented https://github.com/hse-aml/natural-language-processing/blob/master/project/utils.py#L54 and https://github.com/hse-aml/natural-language-processing/blob/master/project/utils.py#L70

ZEMUSHKA avatar Oct 07 '18 13:10 ZEMUSHKA

coursera3 coursera4

ayushmandloi2 avatar Oct 07 '18 13:10 ayushmandloi2

this is my utils.py file i have implemented what is said

ayushmandloi2 avatar Oct 07 '18 13:10 ayushmandloi2

Then it's a Google Colab issue, try to run locally

ZEMUSHKA avatar Oct 07 '18 13:10 ZEMUSHKA

err

Please I don't understand this error can help me !!

ablabedoui avatar Oct 11 '18 07:10 ablabedoui

still the problem not solved i tried running it locally and getting same error what i got in google colab. What exactly we have to do with word_embeddings.tsv file because i don't have this file. Should we download it from some where or code will automatically download it.

ayushmandloi2 avatar Oct 20 '18 18:10 ayushmandloi2

please explain me what we have to do in Part-2 Ranking question with embeddings?

ayushmandloi2 avatar Oct 20 '18 18:10 ayushmandloi2

having the same error on both colab and on the local docker container

fahadshery avatar Nov 18 '18 15:11 fahadshery

Same error. Do we have any solution for this?

sushantdecode avatar Dec 16 '18 19:12 sushantdecode

Was stuck here for a while. Eventually i just copied the load_embeddings code into the cell.

Wong-Vee-Kin avatar Feb 15 '19 05:02 Wong-Vee-Kin

Anyone could solve that problem? I am stuck there right now

danielunifim55 avatar Mar 14 '19 20:03 danielunifim55

I directly copy the function of load_embeddings and question_to_vec to the .ipynb to work around this issue.
I believe it is an Google Colab bug.

libindavis avatar Mar 23 '19 15:03 libindavis

I directly copy the function of load_embeddings and question_to_vec to the .ipynb to work around this issue. I believe it is an Google Colab bug.

can you please drop the code snippet for load_embeddings and question_to_vec

Puru-Malhotra avatar Aug 04 '19 06:08 Puru-Malhotra

I'm also facing the same problem,stuck in it for a while!

rthirumurugan2000 avatar Dec 21 '19 08:12 rthirumurugan2000

Facing the Same Issue. Anyone got any solution to it

nikhilrana015 avatar May 21 '20 06:05 nikhilrana015

NotImplementedError Traceback (most recent call last) in () ----> 1 embeddings, embeddings_dim = load_embeddings('data/word_embeddings.tsv')

/content/utils.py in load_embeddings(embeddings_path) 53 embeddings[word]=embedding 54 dim=len(line)-1 ---> 55 return embeddings,dim 56 57 def question_to_vec(question, embeddings, dim):

NotImplementedError: Open utils.py and fill with your code. In case of Google Colab, download(https://github.com/hse-aml/natural-language-processing/blob/master/project/utils.py), edit locally and upload using '> arrow on the left edge' -> Files -> UPLOAD

can someone solve this

SanjanaNaidu avatar May 29 '20 17:05 SanjanaNaidu

ERROR:root:Internal Python error in the inspect module. Below is the traceback from this internal error.

File "", line unknown SyntaxError: invalid or missing encoding declaration for '/content/utils.py'

SanjanaNaidu avatar May 29 '20 17:05 SanjanaNaidu

whats wrong with mine I followed all the steps but getting the above errors 😭😭😭😭😭😭😭😭😭

SanjanaNaidu avatar May 29 '20 17:05 SanjanaNaidu

@SanjanaNaidu 1.> First try to restart the kernel. If it does not work then try the second way. 2.>when you update the script file and upload it in your project directory. Give the file another name like utils-2.py. delete the previous util.py file and rename the uploaded utils-2.py file as the same name utils.py.

nikhilrana015 avatar May 29 '20 18:05 nikhilrana015

thank you I will try

On Sat, 30 May 2020 at 00:26, Nikhil Rana [email protected] wrote:

@SanjanaNaidu https://github.com/SanjanaNaidu 1.> First try to restart the kernel. If it does not work then try the second way. 2.>when you update the script file and upload it in your project directory. Give the file another name like utils-2.py. delete the previous util.py file and rename the uploaded utils-2.py file as the same name utils.py.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hse-aml/natural-language-processing/issues/27#issuecomment-636133415, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFN3QTZCCRY76DXNPA22BLRUAAMXANCNFSM4FZPFNSA .

SanjanaNaidu avatar May 30 '20 11:05 SanjanaNaidu

NotImplementedError Traceback (most recent call last)

https://localhost:8080/# in () ----> 1 starspace_embeddings, embeddings_dim = load_embeddings('data/starspace_embedding.tsv')

/content/utils.py https://localhost:8080/# in load_embeddings(embeddings_path) 53 dim=len(line)-1 54 return embeddings,dim ---> 55 56 def question_to_vec(question, embeddings, dim): 57 """Transforms a string to an embedding by averaging word embeddings."""

NotImplementedError: Open utils.py and fill with your code. In case of Google Colab, download(https://github.com/hse-aml/natural-language-processing/blob/master/project/utils.py), edit locally and upload using '> arrow on the left edge' -> Files -> UPLOAD

On Sat, 30 May 2020 at 16:40, Sanjana Naidu Gedela [email protected] wrote:

thank you I will try

On Sat, 30 May 2020 at 00:26, Nikhil Rana [email protected] wrote:

@SanjanaNaidu https://github.com/SanjanaNaidu 1.> First try to restart the kernel. If it does not work then try the second way. 2.>when you update the script file and upload it in your project directory. Give the file another name like utils-2.py. delete the previous util.py file and rename the uploaded utils-2.py file as the same name utils.py.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/hse-aml/natural-language-processing/issues/27#issuecomment-636133415 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AIFN3QTZCCRY76DXNPA22BLRUAAMXANCNFSM4FZPFNSA

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hse-aml/natural-language-processing/issues/27#issuecomment-636315721, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFN3QW53QYO67F44H43BS3RUDSSTANCNFSM4FZPFNSA .

SanjanaNaidu avatar Jun 01 '20 07:06 SanjanaNaidu

same error again and again plss help me out

On Mon, 1 Jun 2020 at 13:12, Sanjana Naidu [email protected] wrote:

NotImplementedError Traceback (most recent call last)

https://localhost:8080/# in () ----> 1 starspace_embeddings, embeddings_dim = load_embeddings('data/starspace_embedding.tsv')

/content/utils.py https://localhost:8080/# in load_embeddings(embeddings_path) 53 dim=len(line)-1 54 return embeddings,dim ---> 55 56 def question_to_vec(question, embeddings, dim): 57 """Transforms a string to an embedding by averaging word embeddings."""

NotImplementedError: Open utils.py and fill with your code. In case of Google Colab, download(https://github.com/hse-aml/natural-language-processing/blob/master/project/utils.py), edit locally and upload using '> arrow on the left edge' -> Files -> UPLOAD

On Sat, 30 May 2020 at 16:40, Sanjana Naidu Gedela < [email protected]> wrote:

thank you I will try

On Sat, 30 May 2020 at 00:26, Nikhil Rana [email protected] wrote:

@SanjanaNaidu https://github.com/SanjanaNaidu 1.> First try to restart the kernel. If it does not work then try the second way. 2.>when you update the script file and upload it in your project directory. Give the file another name like utils-2.py. delete the previous util.py file and rename the uploaded utils-2.py file as the same name utils.py.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/hse-aml/natural-language-processing/issues/27#issuecomment-636133415 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AIFN3QTZCCRY76DXNPA22BLRUAAMXANCNFSM4FZPFNSA

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hse-aml/natural-language-processing/issues/27#issuecomment-636315721, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFN3QW53QYO67F44H43BS3RUDSSTANCNFSM4FZPFNSA .

SanjanaNaidu avatar Jun 01 '20 07:06 SanjanaNaidu

There are two ways:

  1. Short workaround: just directly copy functions load_embeddings and question_to_vec to .ipynb.
  2. Do the following steps:
  • remove utils.py with !rm utils.py
  • upload your file: click at [>] to open the left pane, choose file tab, click [upload] and choose your [utils.py]
  • restart runtime: Runtime --> Restart runtime
  • import: from utils import *

MariBax avatar Jun 03 '20 10:06 MariBax

Here is a way to not have to restart runtime: replace the cell from utils import text_prepare by:

from importlib import reload  
reload(sys.modules['utils'])
from utils import text_prepare

and rerun it. That's all !

superzerg avatar May 05 '21 12:05 superzerg