简体   繁体   English

在每个训练时期后获得 memory 用法 - Tensorflow 版本 1.15

[英]Get memory usage after each training epoch - Tensorflow version 1.15

I am using code that requires tensorflow version 1.15.我正在使用需要 tensorflow 版本 1.15 的代码。

However, I would like to record the amount of memory used after each training epoch of a BERT model. In tensorflow version 2, this can be achieved by tf.config.experimental.get_memory_usage .但是,我想记录 memory 在 BERT model 的每个训练周期后使用的数量。在 tensorflow 版本 2 中,这可以通过tf.config.experimental.get_memory_usage来实现。 How could I do the same with version 1.15?我怎样才能对 1.15 版做同样的事情? If it's not a feature of tensorflow, is there another way I could record memory use after each epoch?如果它不是 tensorflow 的功能,是否有另一种方法可以在每个纪元后记录 memory 的使用情况?

Thanks in advance and apologies if simple question - a beginner提前致谢,如果问题很简单 - 初学者,我们深表歉意

EDIT: I am interested in GPU usage编辑:我对 GPU 的用法感兴趣

Periodically call psutil to ask the OS about recent resource consumption.定期调用psutil向操作系统询问最近的资源消耗情况。

import psutil

mem = psutil.virtual_memory()
print(mem)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM