hub Out of memory in a simple programm!!
Created by: LeeYongchao
- 版本、环境信息 1)hub.version'1.7.1' 2)paddle.version'1.7.2' 3)ubuntu16.04
- cuda10 5)paddle.fluid.install_check.run_check() Running Verify Paddle Program ... W0610 10:19:19.803442 8827 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 75, Driver API Version: 10.1, Runtime API Version: 9.0 W0610 10:19:19.805452 8827 device_context.cc:245] device: 0, cuDNN Version: 7.6. Your Paddle works well on SINGLE GPU or CPU. I0610 10:19:20.703788 8827 parallel_executor.cc:440] The Program will be executed on CUDA using ParallelExecutor, 1 cards are used, so 1 programs are executed in parallel. I0610 10:19:20.704022 8827 build_strategy.cc:365] SeqOnlyAllReduceOps:0, num_trainers:1 I0610 10:19:20.704203 8827 parallel_executor.cc:307] Inplace strategy is enabled, when build_strategy.enable_inplace = True I0610 10:19:20.704339 8827 parallel_executor.cc:375] Garbage collection strategy is enabled, when FLAGS_eager_delete_tensor_gb = 0 Your Paddle works well on MUTIPLE GPU or CPU. Your Paddle is installed successfully! Let's start deep Learning with Paddle now
- 我的显存有6G,如果您的显存很大,请多放图片,会看到 显存一直增长 不回收
- 代码很简单,如下: 首先 export CUDA_VISIBLE_DEVICES=0 import os import paddlehub as hub ocr = hub.Module(name="chinese_ocr_db_crnn_server") img_l=os.listdir('./static/images/') # 本目录有20张带文字的图片,如果您显存大,请多放 for img in img_l: _ = ocr.recognize_text(paths=['./static/images/'+img], use_gpu=True)
报错如下:
Error Message Summary:
ResourceExhaustedError:
Out of memory error on GPU 0. Cannot allocate 29.883057MB memory on GPU 0, available memory is only 22.750000MB.
Please check whether there is any other process using GPU 0.
- If yes, please stop them, or start PaddlePaddle on another GPU.
- If no, please decrease the batch size of your model.
at (/paddle/paddle/fluid/memory/allocation/cuda_allocator.cc:69)