run run_pretraining.py but use CPU instead of GPU
- when I use run_pretraining.py to pre-train my model, I have found it use all the memory of GPU, but use CPU to do a lot of computation. type the command "nvtop", the print like below:
Device 0 [GeForce GTX 1080 Ti] PCIe GEN 1@16x RX: 0.000 kB/s TX: 0.000 kB/s GPU 139MHz MEM 405MHz TEMP 44°C FAN 35% POW 18 / 250 W GPU-Util[ 0%] MEM-Util[||||||||||||11.2G/11.7G] Encoder[ 0%] Decoder[ 0%]
Device 1 [GeForce GTX 1080 Ti] PCIe GEN 1@ 4x RX: 0.000 kB/s TX: 0.000 kB/s GPU 139MHz MEM 405MHz TEMP 42°C FAN 34% POW 17 / 250 W GPU-Util[ 0%] MEM-Util[ 0.0G/11.7G] Encoder[ 0%] Decoder[ 0%]
PID USER GPU TYPE MEM Command 15353 feynman 0 Compute 11168Mo 95.3% python
we can see GPU-Util is 0%, and MEM-Util is nearly 100%
We use a pretty standard interface to TensorFlow so I'm guessing it's either a TensorFlow config issue, a data issue, or a hyperparameter issue. If it's using all of your GPU memory my guess is that it is actually using your GPU.
Is it actually training? How many steps are you running? If you have it run for say, 200 steps with batch size 8, how long does it take to complete? If your data file is empty for some reason then it might just be hanging (this is a general Dataset API issue). If you are only running for 20 steps like the example then you might not be checking the utilization at the right time, and most of the time may be in graph building and checkpoint writing mode.
Hi, thank you for your reply。I think I can sure it use CPU to train。As I can see the print info say
”INFO:tensorflow:Running train on CPU“
The total message is below:
INFO:tensorflow:*** Input Files ***
INFO:tensorflow: ./bert.txt
WARNING:tensorflow:Estimator's model_fn (<function model_fn_builder.
In the begin, we see a message of training on CPU, and in the end, we see GPU use information. I don't know what cause this problem。
We use a pretty standard interface to TensorFlow so I'm guessing it's either a TensorFlow config issue, a data issue, or a hyperparameter issue. If it's using all of your GPU memory my guess is that it is actually using your GPU.
Is it actually training? How many steps are you running? If you have it run for say, 200 steps with batch size 8, how long does it take to complete? If your data file is empty for some reason then it might just be hanging (this is a general
DatasetAPI issue). If you are only running for 20 steps like the example then you might not be checking the utilization at the right time, and most of the time may be in graph building and checkpoint writing mode.
Oh I am so sorry! You are right! My datafile is empty! Sorry for this stupid mistake! Please forgive me!