Repository: open-mmlab/mmocr

Issue:
RuntimeError: Only one file(not dir) is allowed in the zipfile
When I test FCE model  to detect the error raised.



Discussion:
![image](https://user-images.githubusercontent.com/32812662/133038230-b237ad6f-5530-4f8a-9573-3dde7040eabd.png)

Is your MMOCR up-to-date? I remember that it's due to the wrong link to FCENet in `ocr.py` but it already got fixed.
> Is your MMOCR up-to-date? I remember that it's due to the wrong link to FCENet in `ocr.py` but it already got fixed.

I use v0.3.0
I'll try to re-download the model
Does it work?
Similar to #516, this checkpoint turns out to be saved by newer PyTorch which offers no backward compatibility by default (https://github.com/pytorch/pytorch/issues/43106). We will run a thorough check and fix any incompatible checkpoints soon. Thanks for reporting!
I just started using mmocr and hit the same issue 
e.g. `python mmocr/utils/ocr.py demo/demo_text_det.jpg --print-result --output test_results --details --det FCE_CTW_DCNv2`
-> `RuntimeError: Only one file(not dir) is allowed in the zipfile` 

@gaotongxiao any quick workaround?
FYI got the same error with `https://download.openmmlab.com/mmocr/textdet/drrg/drrg_r50_fpn_unet_1200e_ctw1500-1abf4f67.pth`
@usuyama Upload your PyTorch to 1.8.0 can be a quick fix


Resolving patch:
diff --git a/mmocr/utils/ocr.py b/mmocr/utils/ocr.py
--- a/mmocr/utils/ocr.py
+++ b/mmocr/utils/ocr.py
@@ -192,16 +192,23 @@ def __init__(self,
                 'dbnet_r50dcnv2_fpnc_sbn_1200e_icdar2015_20210325-91cef9af.pth'
             },
             'DRRG': {
-                'config': 'drrg/drrg_r50_fpn_unet_1200e_ctw1500.py',
-                'ckpt': 'drrg/drrg_r50_fpn_unet_1200e_ctw1500-1abf4f67.pth'
+                'config':
+                'drrg/drrg_r50_fpn_unet_1200e_ctw1500.py',
+                'ckpt':
+                'drrg/drrg_r50_fpn_unet_1200e_ctw1500_20211022-fb30b001.pth'
             },
             'FCE_IC15': {
-                'config': 'fcenet/fcenet_r50_fpn_1500e_icdar2015.py',
-                'ckpt': 'fcenet/fcenet_r50_fpn_1500e_icdar2015-d435c061.pth'
+                'config':
+                'fcenet/fcenet_r50_fpn_1500e_icdar2015.py',
+                'ckpt':
+                'fcenet/fcenet_r50_fpn_1500e_icdar2015_20211022-daefb6ed.pth'
             },
             'FCE_CTW_DCNv2': {
-                'config': 'fcenet/fcenet_r50dcnv2_fpn_1500e_ctw1500.py',
-                'ckpt': 'fcenet/fcenet_r50dcnv2_fpn_1500e_ctw1500-05d740bb.pth'
+                'config':
+                'fcenet/fcenet_r50dcnv2_fpn_1500e_ctw1500.py',
+                'ckpt':
+                'fcenet/' +
+                'fcenet_r50dcnv2_fpn_1500e_ctw1500_20211022-e326d7ec.pth'
             },
             'MaskRCNN_CTW': {
                 'config':
diff --git a/tools/publish_model.py b/tools/publish_model.py
--- a/tools/publish_model.py
+++ b/tools/publish_model.py
@@ -24,7 +24,7 @@ def process_checkpoint(in_file, out_file):
     # add the code here.
     if 'meta' in checkpoint:
         checkpoint['meta'] = {'CLASSES': 0}
-    torch.save(checkpoint, out_file)
+    torch.save(checkpoint, out_file, _use_new_zipfile_serialization=False)
     sha = subprocess.check_output(['sha256sum', out_file]).decode()
     final_file = out_file.rstrip('.pth') + '-{}.pth'.format(sha[:8])
     subprocess.Popen(['mv', out_file, final_file])


Test patch: