2023.8.1唐宇迪Bert学习笔记

唐宇迪bert项目实战——Pycharm版配置参数

软件包:python3.6        TensorFlow 1.12

Pycharm中右键run_classifier选择MoreRun(更多运行),然后选择ModifyRunConfiguration(修改运行配置),在parameters(形参)中编辑配置

一、bert官网项目实例MRPC

run_classifier配置:

--data_dir=../glue/glue_data/MRPC
--task_name=MRPC
--output_dir=../GLUE/output/
--do_train=true
--do_eval=true
--vocab_file=../GLUE/BERT_BASE_DIR/uncased_L-12_H-768_A-12/vocab.txt
--bert_config_file=../GLUE/BERT_BASE_DIR/uncased_L-12_H-768_A-12/bert_config.json
--init_checkpoint=../GLUE/BERT_BASE_DIR/uncased_L-12_H-768_A-12/bert_model.ckpt
--max_seq_length=128
--train_batch_size=2
--learning_rate=2e-5
--num_train_epochs=3.0

二、bert情感分析项目实例BERT_Chinese_Classification

run_classifier配置:

--data_dir=data
--output_dir=sim_model
--task_name=Sim
--do_train=true
--do_eval=true
--vocab_file=../GLUE/BERT_BASE_DIR/chinese_L-12_H-768_A-12/vocab.txt
--bert_config_file=../GLUE/BERT_BASE_DIR/chinese_L-12_H-768_A-12/bert_config.json
--init_checkpoint=../GLUE/BERT_BASE_DIR/chinese_L-12_H-768_A-12/bert_model.ckpt
--max_seq_length=80
--train_batch_size=32
--learning_rate=5e-5
--num_train_epochs=3.0

三、bert命名实体识别项目实例BERT-BiLSTM-CRF-NER-master

run.py配置:

-data_dir=D:\\StudySpace\\BERT\\BERT-BiLSTM-CRF-NER-master\\data
-output_dir=D:\\StudySpace\\BERT\\BERT-BiLSTM-CRF-NER-master\\result
-init_checkpoint=bert_model.ckpt
-vocab_file=D:\\StudySpace\\BERT\\BERT-BiLSTM-CRF-NER-master\\chinese_L-12_H-768_A-12\\vocab.txt
-bert_config_file=D:\\StudySpace\\BERT\BERT-BiLSTM-CRF-NER-master\\chinese_L-12_H-768_A-12\\bert_config.json
-batch_size=8

-init_checkpoint只能用相对路径

运行时报错:

Traceback (most recent call last): File "D:/WorkSpace/PythonWork/BERT/BERT-BiLSTM-CRF-NER-master/run.py", line 37, in <module> train_ner() File "D:/WorkSpace/PythonWork/BERT/BERT-BiLSTM-CRF-NER-master/run.py", line 33, in train_ner train(args=args) File "D:\WorkSpace\PythonWork\BERT\BERT-BiLSTM-CRF-NER-master\bert_base\train\bert_lstm_ner.py", line 613, in train early_stopping_hook = tf.estimator.experimental.stop_if_no_decrease_hook( AttributeError: module 'tensorflow.python.estimator.api.estimator' has no attribute 'experimental'

这个错误是由于你使用的 TensorFlow 版本不支持 experimental 模块导致的。在较新版本的 TensorFlow 中,experimental 模块已经被移除。看来1.12还是高了,1.11应该行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值