question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Error in Sentence & word encoding for Hindi]

See original GitHub issue

Python: 3.8 torch==1.6.0+cpu torchvision==0.7.0+cpu inltk=0.9 OS: Ubuntu 20

Steps followed: As given in the documentation, https://inltk.readthedocs.io/en/latest/api_docs.html

from inltk.inltk import setup
setup('hi')
Downloading Model. This might take time, depending on your internet connection. Please be patient.
We'll only do this for the first time.
Downloading Model. This might take time, depending on your internet connection. Please be patient.
We'll only do this for the first time.
Done!
>>> from inltk.inltk import get_embedding_vectors
>>> vectors = get_embedding_vectors('भारत', 'hi')
Traceback (most recent call last):                                                                             
  File "<stdin>", line 1, in <module>
  File "env3/lib/python3.8/site-packages/inltk/inltk.py", line 100, in get_embedding_vectors
    learn = load_learner(path / 'models' / f'{language_code}')
  File "env3/lib/python3.8/site-packages/fastai/basic_train.py", line 626, in load_learner
    res = clas_func(data, model, **state)
  File "env3/lib/python3.8/site-packages/fastai/text/learner.py", line 52, in __init__
    super().__init__(data, model, metrics=metrics, **learn_kwargs)
  File "<string>", line 20, in __init__
  File "env3/lib/python3.8/site-packages/fastai/basic_train.py", line 166, in __post_init__
    self.model = self.model.to(self.data.device)
  File "env3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 607, in to
    return self._apply(convert)
  File "env3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 354, in _apply
    module._apply(fn)
  File "env3/home/sarah/github/Offensive_Hindi/env3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 354, in _apply
    module._apply(fn)
  File "env3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 354, in _apply
    module._apply(fn)
  [Previous line repeated 1 more time]
  File "env3/lib/python3.8/site-packages/torch/nn/modules/rnn.py", line 159, 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 "env3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in __getattr__
    raise ModuleAttributeError("'{}' object has no attribute '{}'".format(
torch.nn.modules.module.ModuleAttributeError: 'LSTM' object has no attribute '_flat_weights_names'

Same error as above occurs when using

>>> from inltk.inltk import get_sentence_encoding
>>> encoding = get_sentence_encoding('मुझे अपने देश से', 'hi')
......
env3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in __getattr__
    raise ModuleAttributeError("'{}' object has no attribute '{}'".format(
torch.nn.modules.module.ModuleAttributeError: 'LSTM' object has no attribute '_flat_weights_names'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sara-02commented, Oct 30, 2020

@goru001 I see. I think we can close this issue as it is no longer specific to the embedding use case, and create another issue to track the Python version, meanwhile, I will send a PR requiring the use of specific versions.

0reactions
goru001commented, Oct 30, 2020

@sara-02 Thanks for sharing the notebook. I checked it. I was not able to reproduce this on python version 3.6.3 and 3.6.8, but was able to reproduce on 3.6.9. I also tried this on Kaggle kernels which has python 3.7.6 and there also it seems to be working fine. So I think it has something to do with python version I guess, and will take some time for me to figure out. Can you switch to v3.6.8 or v3.6.3 ? It should work fine post that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Investigating limits to verbal prediction in an SOV language
Abstract. The role of prediction during sentence comprehension is widely acknowledged to be very critical in SOV languages. Robust clause-final verbal ...
Read more >
Text Not Displaying in Hindi - India Typing
Solution: Sometimes you will see Questions marks, blocks or garbage character instead of Hindi characters on Google chrome. The reason is Character encoding....
Read more >
Detection and Correction of Grammatical Errors in Hindi ...
In a research paper by Sharmila Mani et. al. [2] [5] , has worked on correction of grammatical errors using a hybrid approach...
Read more >
Grammatical Error Annotation Tool for Hindi - Repository
This tool is built to automatically extract edits from a parallel corpus of incorrect and correct sentences and classify them according to a...
Read more >
Turn on automatic language detection - Microsoft Support
The Detect language automatically option, available in Word and Outlook on Windows, detects the language that you are typing and automatically enables the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found