Coder Social home page Coder Social logo

vincent131499 / textclassifier_transformer Goto Github PK

View Code? Open in Web Editor NEW
159.0 159.0 46.0 76.53 MB

个人基于谷歌开源的BERT编写的文本分类器(基于微调方式),可自由加载NLP领域知名的预训练语言模型BERT、Bert-wwm、Roberta、ALBert以及ERNIE1.0

Python 98.05% Shell 1.95%

textclassifier_transformer's People

Contributors

ares5221 avatar vincent131499 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

textclassifier_transformer's Issues

运行test.serving.py报错

WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

2020-05-11 10:06:38.571054: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: AVX AVX2
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2020-05-11 10:06:38.574442: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 12. Tune using inter_op_parallelism_threads for best performance.
WARNING:tensorflow:From D:\anaconda\lib\site-packages\tensorflow\contrib\predictor\saved_model_predictor.py:153: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.
WARNING:tensorflow:From D:\anaconda\lib\site-packages\tensorflow\python\training\saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
WARNING:tensorflow:From D:\pycharm\sentiment\bert\tokenization.py:125: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

Process finished with exit code -1073741819 (0xC0000005)

网上的方法都试了,能否请您告知是什么原因?

robert 模型导出失败

您好,使用robert训练后,导出模型失败
显示找不到mobile_0_roberta_base,这个是什么原因呢
image

模型兼容

这个脚本可以直接加载项目中罗列的模型么?还是只契合roberta

在使用albert-zh的tiny模型训练时报错

报错信息为:
Shape of Variable bert/embeddings/word_embeddings:0((21128, 312)) doesn't match with shape of tensor bert/embeddings/word_embeddings([21128, 128]) from checkpoint reader.

在albert配置文件里,有:
"hidden_size": 312,
"embedding_size": 128

export.sh出错

Traceback (most recent call last):
File "run_classifier_serving.py", line 1087, in
tf.app.run()
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "run_classifier_serving.py", line 1077, in main
estimator.export_saved_model(FLAGS.export_dir, serving_input_fn)
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 732, in export_saved_model
strip_default_attrs=True)
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 829, in _export_all_saved_models
export_dir = export_lib.get_timestamped_export_dir(export_dir_base)
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow/python/saved_model/model_utils/export_utils.py", line 216, in get_timestamped_export_dir
compat.as_bytes(export_dir_base), compat.as_bytes(str(timestamp)))
File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 65, in as_bytes
(bytes_or_text,))
TypeError: Expected binary or unicode string, got None

bash train.sh 报错

Traceback (most recent call last):
File "run_classifier_serving.py", line 1086, in
tf.app.run()
File "/home/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/.local/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/.local/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "run_classifier_serving.py", line 901, in main
bert_config = modeling.BertConfig.from_json_file(FLAGS.bert_config_file)
File "/home/.local/share/Trash/files/TextClassifier_BERT-master/modeling.py", line 93, in from_json_file
text = reader.read()
File "/home/.local/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 122, in read
self._preread_check()
File "/home/.local/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError: ./chinese_roberta_zh_l12/bert_config.json; No such file or directory

请教f1的计算方式

hello,想请教一下f1的计算方式:
您这里是这样计算的:f1 = (2 * precision[0] * recall[0] / (precision[0] + recall[0]),recall[1]),这里f1的update只用了recall,请问是怎么考虑的呢?
我觉得应该是这样:f1_update = 2 * update_op_precision * update_op_recall / (update_op_precision + update_op_recall + eps)
麻烦了,多谢多谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.