Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..
So i use ELMoForManyLangs for my NLP task. I follow the way that is on https://www.kaggle.com/realdeo/praktikum-nama-npm/notebook#Demo-Word-Embedding.
The code that i've tried is like this:
!cp -r /content/drive/MyDrive/ColabNotebooks/158 
!git clone https://github.com/HIT-SCIR/ELMoForManyLangs
!pip install -e ELMoForManyLangs/
!cp/content/ELMoForManyLangs/ELMoForManyLangs/elmoformanylangs/configs/cnn_50_100_512_4096_sample.json /content/drive/MyDrive/ColabNotebooks/158/config.json

file = open("/content/drive/MyDrive/ColabNotebooks/158/config.json", "w")

teks = '{"seed": 1, "gpu": 3, "train_path": "/users4/conll18st/raw_text/Indonesian/id-20m.raw", "valid_path": null, "test_path": null, "config_path": "/users4/conll18st/elmo/configs/cnn_50_100_512_4096_sample.json", "word_embedding": null, "optimizer": "adam", "lr": 0.001, "lr_decay": 0.8, "model": "/users4/conll18st/elmo/src/final_models/id.model", "batch_size": 32, "max_epoch": 10, "clip_grad": 5, "max_sent_len": 20, "min_count": 3, "max_vocab_size": 150000, "save_classify_layer": false, "valid_size": 0, "eval_steps": 10000}'
import ELMoForManyLangs.elmoformanylangs as elmo
Initially it went well until I got an error while running this code :
e = elmo.Embedder('/content/drive/MyDrive/ColabNotebooks/158') 

The error is like this :
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

So how can I handle this error?

What I have tried:

to fix the error i've tried this :
e = elmo.Embedder('/content/drive/MyDrive/ColabNotebooks/158', encoding='UTF-8') 

But it gives me another error :
__init__() got an unexpected keyword argument 'encoding'
Posted
Updated 23-Mar-21 4:02am
v3
Comments
Richard MacCutchan 23-Mar-21 9:45am    
"But it gives me another error"
Which you leave us to guess.

What is Embedder, and what is it supposed to do?
sarada07 23-Mar-21 9:55am    
I've updated the question. So embedder is a type of word representation that allows words with similar meaning to have a similar representation. Elmo is one of the embedder type
Richard MacCutchan 23-Mar-21 10:01am    
Well the first error message suggests that it is expecting some JSON data and does not receive it. The second error message suggests that the extra parameter is not valid. you need to go back to the ELMoForManyLangs documentation to see why it is raising these error messages.
Richard MacCutchan 23-Mar-21 10:05am    
I just had a look at the tutorial and you missed the part where you are supposed to write the JSON data to your output file. Little wonder that it fails when it tries to read an empty file.
sarada07 23-Mar-21 10:38am    
Thank you for telling me. I've fixed the missed part and it's no longer an error now. Thankyouu :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900