macanv / BERT-BiLSTM-CRF-NER

Tensorflow solution of NER task Using BiLSTM-CRF model with Google BERT Fine-tuning And private Server services
https://github.com/macanv/BERT-BiLSMT-CRF-NER
4.72k stars 1.26k forks source link

默认是用cpu? #167

Open BucherLi opened 5 years ago

BucherLi commented 5 years ago

运行bert-base-ner-train 训练结果 ,为啥没用到gpu,tf版本1.12, python版本3.6

       ARG   VALUE

 batch_size = 64
bert_config_file =~/chinese_L-12_H-768_A-12/bert_config.json
            cell = lstm
           clean = True
            clip = 0.5
        data_dir = ~/BERT-BiLSTM-CRF-NER-master/train
      device_map = 0
         do_eval = True
   do_lower_case = True
      do_predict = True
        do_train = True
    dropout_rate = 0.5
 filter_adam_var = False
 init_checkpoint =~/chinese_L-12_H-768_A-12/bert_model.ckpt
      label_list = None
   learning_rate = 1e-05
       lstm_size = 128
  max_seq_length = 128
             ner = ner
      num_layers = 1
num_train_epochs = 10
      output_dir = model

save_checkpoints_steps = 500 save_summary_steps = 500 verbose = False vocab_file =~/chinese_L-12_H-768_A-12/vocab.txt warmup_proportion = 0.1

WARNING:tensorflow:From /data/home/user00/python36.8/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From /data/home/user00/python36.8/lib/python3.6/site-packages/bert_base/train/bert_lstm_ner.py:334: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. shape of input_ids (64, 128) WARNING:tensorflow:From /data/home/user00/python36.8/lib/python3.6/site-packages/bert_base/bert/modeling.py:359: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. WARNING:tensorflow:From /data/home/user00/python36.8/lib/python3.6/site-packages/bert_base/bert/modeling.py:673: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version. Instructions for updating: Use keras.layers.dense instead. WARNING:tensorflow:From /data/home/user00/python36.8/lib/python3.6/site-packages/tensorflow/contrib/crf/python/ops/crf.py:213: dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version. Instructions for updating: Please use keras.layers.RNN(cell), which is equivalent to this API WARNING:tensorflow:From /data/home/user00/python36.8/lib/python3.6/site-packages/tensorflow/python/training/learning_rate_decay_v2.py:321: div (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Deprecated in favor of operator or tf.math.divide. 2019-06-25 21:44:04.525045: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2019-06-25 21:44:04.530741: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2199860000 Hz 2019-06-25 21:44:04.531249: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x9587ca0 executing computations on platform Host. Devices: 2019-06-25 21:44:04.531282: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): ,

macanv commented 5 years ago

其他程序也是默认不使用GPU么,没遇到过这个bug,可能是你的python中的tf环境有问题。

BucherLi commented 5 years ago

其他程序也是默认不使用GPU么,没遇到过这个bug,可能是你的python中的tf环境有问题。

google bert 源码的分类训练默认用的GPU,bert-as-service启动的时候默认也是用的Gpu。 你能发下你的环境吗

xuetrdi commented 5 years ago

我也遇到同样的问题,使用bert源码训练,然后部署服务之后就检测不到GPU运行。

hurricanedjp commented 5 years ago

我之前也是,后来发现有其他进程在使用GPU的时候,服务就不会使用GPU。把其他进程杀死或者找个没人用的GPU都可以检测到。等服务起好了,其他程序训练测试都没影响的

xuetrdi commented 5 years ago

@hurricanedjp 好的,多谢。

learnxy commented 5 years ago

请问楼主的问题解决了么,我现在也不能使用GPU,我也检查了我驱动(410.78),cuda(10.0),python(3.6.9)tensorflow-gpu(1.13.1)

henryhust commented 5 years ago

pip install tensorflow-gpu = 1.12 安装tensorflow gpu版本