Skip to content

Instantly share code, notes, and snippets.

@mohdsanadzakirizvi
Created January 9, 2020 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohdsanadzakirizvi/c5ddbe5ded5ed0cd709bb6edb7acaa9a to your computer and use it in GitHub Desktop.
Save mohdsanadzakirizvi/c5ddbe5ded5ed0cd709bb6edb7acaa9a to your computer and use it in GitHub Desktop.
from inltk.inltk import get_embedding_vectors
# get embedding for input words
vectors = get_embedding_vectors("विश्लेषिकी विद्या", "hi")
print(vectors)
# print shape of the first word
print("shape:", vectors[0].shape)
@atif-icp
Copy link

atif-icp commented Aug 2, 2021

After running the intlk_embed.py, I got the following error. Pls help
Traceback (most recent call last):
File "C:/Users/Dr. Atif Khan/AppData/Local/Programs/Python/Python39/wordevc sim.py", line 7, in
vectors = get_embedding_vectors("विश्लेषिकी विद्या", "hi")
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\inltk\inltk.py", line 100, in get_embedding_vectors
learn = load_learner(path / 'models' / f'{language_code}')
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\fastai\basic_train.py", line 626, in load_learner
res = clas_func(data, model, **state)
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\fastai\text\learner.py", line 52, in init
super().init(data, model, metrics=metrics, **learn_kwargs)
File "", line 20, in init
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\fastai\basic_train.py", line 166, in post_init
self.model = self.model.to(self.data.device)
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 852, in to
return self._apply(convert)
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 530, in _apply
module._apply(fn)
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 530, in _apply
module._apply(fn)
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 530, in _apply
module._apply(fn)
[Previous line repeated 1 more time]
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\rnn.py", line 187, in _apply
self._flat_weights = [(lambda wn: getattr(self, wn) if hasattr(self, wn) else None)(wn) for wn in self._flat_weights_names]
File "C:\Users\Dr. Atif Khan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1130, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'LSTM' object has no attribute '_flat_weights_names'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment