报错:
attention_scores = torch.matmul(query_layer, key_layer.transpose(-1, -2))
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 22.05 GiB total capacity; 18.55 GiB already allocated; 16.12 MiB free; 18.59 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
代码:
hanlp_handle = hanlp.load(hanlp.pretrained.mtl.CLOSE_TOK_POS_NER_SRL_DEP_SDP_CON_ERNIE_GRAM_ZH)
response = hanlp_handle(text, tasks=‘ner/msra’)
result = response.get(‘ner/msra’)
应该怎么修改?
谢谢!