

把相关的模型、数据、文件都下载下来,上传到cloud storage上。
通过下面的命令,把相关文件转移到VM上:

安装一个tree命令,可以打印出现在的VM文件结构:

定义模型的位置,这是google放在云端的,可以直接调用:
export BERT_LARGE_DIR=gs://bert_models/2018_10_18/uncased_L-24_H-1024_A-16

然后进入bert-master目录,跑下面的命令:
python run_squad.py \
--vocab_file=$BERT_LARGE_DIR/vocab.txt \
--bert_config_file=$BERT_LARGE_DIR/bert_config.json \
--init_checkpoint=$BERT_LARGE_DIR/bert_model.ckpt \
--do_train=True \
--train_file=../SQUAD_DIR/train-v2.0.json \
--do_predict=True \
--predict_file=../SQUAD_DIR/dev-v2.0.json \
--train_batch_size=24 \
--learning_rate=3e-5 \
--num_train_epochs=2.0 \
--max_seq_length=384 \
--doc_stride=128 \
--output_dir=gs://patest1/output/ \
--use_tpu=True \
--tpu_name=$TPU_NAME \
--version_2_with_negative=True

网友评论