kamalkraj / bert-squad Goto Github PK
View Code? Open in Web Editor NEWSQuAD Question Answering Using BERT, PyTorch
License: GNU Affero General Public License v3.0
SQuAD Question Answering Using BERT, PyTorch
License: GNU Affero General Public License v3.0
Hello,
I've run into a strange issue. I first tested the code and it worked without any problems. However, suddenly after changing absolutely nothing, I'm getting the error:
ModuleNotFoundError: No module named 'pytorch_transformers'
I've definitely installed all of the requirements and I have no idea what is happening. Any advice?
hi, loved the repo.
link to download the model appears broken.
can you update?
thanks, a.
Hi Kamal,
Can you please share how to make this system for custom squad like dataset + fine-tune model ??
Hey man, nice repo!
Can you please push the requirements.txt of the project?
thank you!
Can I further fine-tune this model on SQuAD 2.0 or any other dataset?
THERE IS "from utils_squad_evaluate import EVAL_OPTS, main as evaluate_on_squad" IN "run.squad.py" , HOW TO GET "utils_squad_evaluate"?
Is this based BERT SQUAD 2.0 ?
when i import the statement from bert import QA its throwing an error saying cannot import name 'QA'
Hi,
I want to train bert model again with updated dataset. I updated run_squad code according to the train/readme file, but I got AssertionError. How do I resolve this error for train?
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--train_file /train-v1.1.json", default=None, type=str, required=True)
parser.add_argument("--predict_file /dev-v1.1.json", default=None, type=str, required=True)
parser.add_argument("--model_type bert ", default=None, type=str, required=True)
parser.add_argument("--model_name_or_path bert-large-uncased-whole-word-masking", default=None, type=str, required=True)
parser.add_argument("--output_dir ../models/wwm_uncased_finetuned_squad/", default=None, type=str, required=True) parser.add_argument("--max_seq_length", default=384, type=int)
parser.add_argument("--doc_stride", default=128, type=int)
parser.add_argument("--do_train", action='store_true')
parser.add_argument("--do_eval", action='store_true')
parser.add_argument("--do_lower_case", action='store_true')
parser.add_argument("--per_gpu_train_batch_size", default=3, type=int)
parser.add_argument("--per_gpu_eval_batch_size", default=3, type=int)
parser.add_argument("--learning_rate", default=3e-5, type=float)
parser.add_argument("--num_train_epochs", default=2.0, type=float)
parser.add_argument("--nproc_per_node", default=8, type=int)
args = parser.parse_args()
It is taking too much time to give reply around 2-5 mins of to give answer and 2-5 mins to load the model which is too much time in real time analysis.
The model for this application generated using BERT-Large uncase. this application takes time to run in our laptops and local desktops. could u please provide a smaller version of model also could you please let us know how to train our own model to run this application.
I tested it. There is just a simple error.
When I copy the code from README.md
NameError: name 'ans' is not defined
I fixed it >> print(answer.keys())
Link of the model the repo is referring to is broken.
Could anyone update the link?
I try to run code like this
python3 run_squad.py \
--model_type bert \
--model_name_or_path bert-large-uncased-whole-word-masking \
--do_train \
--do_eval \
--do_lower_case \
--train_file train-v1.1.json \
--predict_file dev-v1.1.json \
--learning_rate 3e-5 \
--num_train_epochs 2 \
--max_seq_length 384 \
--doc_stride 128 \
--output_dir ../models/wwm_uncased_finetuned_squad/ \
--per_gpu_eval_batch_size=3 \
--per_gpu_train_batch_size=3 \
--overwrite_output_dir \
But I get the bad result F1 score only 7.35
I don't know how to solve it
Thanks a lot for your help
Hi Kamal,
Can you please share how to do finetuning with custom dataset
Hi friends, I get this error:
Model name 'model/bert_config.json' was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc). We assumed 'model/bert_config.json' was a path or url but couldn't find any file associated to this path or url.
Traceback (most recent call last):
File BERT-SQuAD/api.py", line 9, in
model = QA("model")
File "BERT-SQuAD/bert.py", line 30, in init
self.model, self.tokenizer = self.load_model(model_path)
File "BERT-SQuAD/bert.py", line 40, in load_model
config = BertConfig.from_pretrained(model_path + "/bert_config.json")
File "venv/lib/python3.9/site-packages/pytorch_transformers/modeling_utils.py", line 194, in from_pretrained
raise e
File "BERT-SQuAD/venv/lib/python3.9/site-packages/pytorch_transformers/modeling_utils.py", line 180, in from_pretrained
resolved_config_file = cached_path(config_file, cache_dir=cache_dir, force_download=force_download, proxies=proxies)
File "BERT-SQuAD/venv/lib/python3.9/site-packages/pytorch_transformers/file_utils.py", line 124, in cached_path
raise EnvironmentError("file {} not found".format(url_or_filename))
OSError: file model/bert_config.json not found
any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.