Open ghshin-github opened 3 years ago
Thank you for your interest in our work.
A few things need to be downloaded and placed in the proper directories before running the files in analysis
. For this, please follow the instructions on README.md in analysis
. The current code should work fine with these additional files.
myLSTM is a hand-coded template for the small LSTM (or lstm
as a model_name we use here). This template can be useful when looking into intermediate steps within the LSTM calculation.
However, for the current purposes, you could also simply load the model using load_state_dict()
. In order to do this, you first import a model class, and load the parameters into the model. The details of how to load a model this way are given here. The model class for the small LSTM can be imported from model.py
in the repository here.
sys.path.append('../..') is required when importing from models
module, which is not inside analysis
. Importing this way should be just fine, but there are other ways to import from models
as well.
For example, you can delete sys.path.append('../..')
and replace
from models.CalcSentProbsModel import CalcSentProbsModel
by
from ...models.CalcSentProbsModel import CalcSentProbsModel
.
For this to work, you need to run CalcSentProbs.py
as a module, as in
python -m neural_constructions.DAIS.analysis.CalcSentProbs [model_name]
.
When running this, you also need to be outside the directory neural_constructions
.
I hope this is helpful in some way.
Recently I have read this paper ("Investigating verb bias in neural language models") and looked up the github repository to better understand how the study was conducted. I tried to run individual code files, but I noticed that there are things missing.
I have particular questions about the code as follows:
Regarding myLSTM in ExtractHiddenModel.py:
Regarding sys.path.append('../..') in CalcSentProbs.py (and the others as well):
I would appreciate it if you could kindly answer my inquries above.