ftarlaci / GPT2sQA

Fine-tuning GPT-2 Small for Question Answering
Apache License 2.0
129 stars 35 forks source link

Instructions for installing packages #1

Open NatCusack opened 5 years ago

NatCusack commented 5 years ago

Hi! I'm researching this for a college project and I need a bit of help setting this up. I cloned the repo and created a virtual env in python 3.6, install the requirements.txt and I ran python setup.py build and then python setup.py install after that I try to run the the training command: python gpt2_squad.py --output_dir=output/ --train_file=dataset/dataset/train-v2.0.json --do_train --train_batch_size=32 --predict_file=dataset/dataset/dev-v2.0.json --do_predict

but it returns this Error: Traceback (most recent call last): File "gpt2_squad.py", line 39, in <module> from gpt2sqa.file_utils import PYTORCH_PRETRAINED_GPT2_CACHE, WEIGHTS_NAME, CONFIG_NAME File "/home/domainproxy/NateCusack/QA_Proj/GPT2sQA/gpt2sqa/__init__.py", line 5, in <module> from gpt2sqa.gpt2.gpt2model import GPT2Model File "/home/domainproxy/NateCusack/QA_Proj/GPT2sQA/gpt2sqa/gpt2/gpt2model.py", line 7, in <module> from gpt2_question_answering.gpt2.layer_norm import LayerNorm ModuleNotFoundError: No module named 'gpt2_question_answering' Sorry if this is a really basic question I'm still pretty new to ML.
Thanks in Advance! Nathan

nicholas-abad commented 4 years ago

Hi @NatCusack , I'm not too sure if you were able to figure this out yet but within several files, there was an incorrect naming in folder names within the repository itself. To fix this, where there's a gpt_question_answering when importing modules, change this into gpt2sqa.

For example, in gpt2model.py, instead of having from gpt2_question_answering.gpt2.layer_norm import LayerNorm make this into from gpt2sqa.gpt2.layer_norm import LayerNorm.

I'll create a pull request for this shortly but this is the case in the gpt2model.py and the gpt2pretrained.py files.