This needs to be handled better.
File "/opt/marie-icr/marie/executor/ner/ner_extraction_executor.py", line 701, in preprocess
ocr_results, frames = obtain_ocr(src_image, self.text_executor)
File "/opt/marie-icr/marie/executor/ner/ner_extraction_executor.py", line 78, in obtain_ocr
results = text_executor.extract(docs, **kwa)
File "/opt/marie-icr/marie/executor/text_extraction_executor.py", line 369, in extract
logger.error("Extract error", error)
Message: 'Extract error'
Arguments: (RuntimeError('CUDA out of memory. Tried to allocate 362.00 MiB (GPU 0; 47.54 GiB total capacity; 38.29 GiB already allocated; 358.94 MiB free; 44.88 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF'),)
--- Logging error ---
Traceback (most recent call last):
File "/opt/marie-icr/marie/executor/text_extraction_executor.py", line 346, in extract
results = self.__process_extract_fullpage(
File "/opt/marie-icr/marie/executor/text_extraction_executor.py", line 164, in __process_extract_fullpage
result, overlay_image = self.icr_processor.recognize(
File "/opt/marie-icr/marie/document/icr_processor.py", line 250, in recognize
raise ex
File "/opt/marie-icr/marie/document/icr_processor.py", line 119, in recognize
results = self.recognize_from_fragments(fragments)
File "/opt/marie-icr/marie/document/trocr_icr_processor.py", line 251, in recognize_from_fragments
raise ex
File "/opt/marie-icr/marie/document/trocr_icr_processor.py", line 232, in recognize_from_fragments
predictions, scores = get_text(
File "/opt/marie-icr/marie/document/trocr_icr_processor.py", line 122, in get_text
results = task.inference_step(
2022-08-15 09:34:20,276 DEBG 'wsgi-app' stdout output:
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/tasks/fairseq_task.py", line 542, in inference_step
return generator.generate(
File "/opt/venv/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/sequence_generator.py", line 204, in generate
return self._generate(sample, **kwargs)
File "/opt/marie-icr/marie/models/unilm/trocr/generator.py", line 144, in _generate
lprobs, avg_attn_scores = self.model.forward_decoder(
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/sequence_generator.py", line 819, in forward_decoder
decoder_out = model.decoder.forward(
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/models/transformer/transformer_decoder.py", line 217, in forward
x, extra = self.extract_features(
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/models/transformer/transformer_decoder.py", line 239, in extract_features
return self.extract_features_scriptable(
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/models/transformer/transformer_decoder.py", line 340, in extract_features_scriptable
x, layer_attn, _ = layer(
File "/opt/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/modules/transformer_layer.py", line 487, in forward
x, attn = self.encoder_attn(
File "/opt/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/fairseq-0.12.2-py3.8-linux-x86_64.egg/fairseq/modules/multihead_attention.py", line 593, in forward
k = self.k_proj(key)
File "/opt/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: CUDA out of memory. Tried to allocate 362.00 MiB (GPU 0; 47.54 GiB total capacity; 38.29 GiB already allocated; 356.94 MiB free; 44.88 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF