首页 > 解决方案 > TensorFlow 服务非常不稳定

问题描述

我在带有 TF 服务的 Tesla T4 中部署了一个更快的 rcnn 模型和两个分段模型。不知何故,较旧的 tf 服务版本(1.15.0)比最新的 tf 服务版本工作得更好(可能是因为模型是在旧 tf 版本上构建并导出的)。我正在使用以下环境变量

TF_FORCE_GPU_ALLOW_GROWTH=true # This helped me to get over the OOM errors while loading the models 

我曾经批量处理 300 个 GRPC 请求,并且运行良好。但是目前它在前几批之后经常抛出OOM警告。

2021-10-28 19:04:57.475951: W external/org_tensorflow/tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 4.01GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.

关于如何解决这个问题的任何想法?我还注意到推理后没有释放 gpu 内存(这也发生在早些时候,但它没有引发 OOM 错误)。我没有禁用 TF 服务中的垃圾收集。有没有其他方法可以有效地收集垃圾并释放内存?提前致谢 :)。

标签: pythontensorflowtensorflow-serving

解决方案


推荐阅读