AttributeError: 'LSTM' object has no attribute '_flat_weights'

I am getting the error while executing the below code
Code:
from inltk.inltk import get_similar_sentences
get_similar_sentences(‘मैं आज बहुत खुश हूं’, 3, ‘hi’, degree_of_aug = 0.1)
Error:
AttributeError Traceback (most recent call last)
Cell In[11], line 1
----> 1 get_similar_sentences(‘मैं आज बहुत खुश हूं’, 3, ‘hi’, degree_of_aug = 0.1)

File ~\anaconda3\envs\env-1\lib\site-packages\inltk\inltk.py:137, in get_similar_sentences(sen, no_of_variations, language_code, degree_of_aug)
135 tok = LanguageTokenizer(language_code)
136 token_ids = tok.numericalize(sen)
→ 137 embedding_vectors = get_embedding_vectors(sen, language_code)
138 # get learner
139 defaults.device = torch.device(‘cpu’)

File ~\anaconda3\envs\env-1\lib\site-packages\inltk\inltk.py:100, in get_embedding_vectors(input, language_code)
98 defaults.device = torch.device(‘cpu’)
99 path = Path(file).parent
→ 100 learn = load_learner(path / ‘models’ / f’{language_code}')
101 encoder = get_model(learn.model)[0]
102 encoder.reset()

File ~\anaconda3\envs\env-1\lib\site-packages\fastai\basic_train.py:619, in load_learner(path, file, test, **db_kwargs)
617 “Load a Learner object saved with export_state in path/file with empty data, optionally add test and load on cpu. file can be file-like (file or buffer)”
618 source = Path(path)/file if is_pathlike(file) else file
→ 619 state = torch.load(source, map_location=‘cpu’) if defaults.device == torch.device(‘cpu’) else torch.load(source)
620 model = state.pop(‘model’)
621 src = LabelLists.load_state(path, state.pop(‘data’))

File ~\anaconda3\envs\env-1\lib\site-packages\torch\serialization.py:815, in load(f, map_location, pickle_module, weights_only, **pickle_load_args)
813 except RuntimeError as e:
814 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None
→ 815 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)

File ~\anaconda3\envs\env-1\lib\site-packages\torch\serialization.py:1043, in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
1041 unpickler = UnpicklerWrapper(f, **pickle_load_args)
1042 unpickler.persistent_load = persistent_load
→ 1043 result = unpickler.load()
1045 deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)
1047 offset = f.tell() if f_should_read_directly else None

File ~\anaconda3\envs\env-1\lib\site-packages\torch\nn\modules\rnn.py:325, in RNNBase.setstate(self, d)
320 self._flat_weights_names.extend(weights[:2])
321 self._flat_weights = [getattr(self, wn) if hasattr(self, wn) else None
322 for wn in self._flat_weights_names]
324 self._flat_weight_refs = [weakref.ref(w) if w is not None else None
→ 325 for w in self._flat_weights]

File ~\anaconda3\envs\env-1\lib\site-packages\torch\nn\modules\module.py:1614, in Module.getattr(self, name)
1612 if name in modules:
1613 return modules[name]
→ 1614 raise AttributeError(“‘{}’ object has no attribute ‘{}’”.format(
1615 type(self).name, name))

AttributeError: ‘LSTM’ object has no attribute ‘_flat_weights’