-
Notifications
You must be signed in to change notification settings - Fork 12
load gzipped models #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This merge came to fast for me. I suggest reverting.
@@ -131,7 +131,7 @@ def process(self): | |||
Produce a new output file by serialising the resulting hierarchy. | |||
""" | |||
# from ocropus-rpred: | |||
self.network = load_object(self.get_model(), verbose=1) | |||
self.network = load_object(self.get_model(), zip=1, verbose=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary. The default setting zip=0
already decompressed files if they are named *.gz
. See here:
ocrd_cis/ocrd_cis/ocropy/ocrolib/common.py
Line 447 in b7bba57
if zip==0 and fname.endswith(".gz"): |
Ignoring the file name will now make parameter files (or workflow definitions) fail which don't use .gz
suffix, for example because of an old workaround to #41
fine by me. |
I was a bit too eager with the PR, this was not meant to be merged as such, I had a lot of trouble getting ocropy to find the models and this fixed it for me. Ocropy should gunzip even with |
@kba In #41 I wrote this summary of what gets searched. I agree we should test this, document this, and probably even generalise a little (all ocrolib search directories except |
You mean like https://ocr-d.de/en/models#ocropy--ocrd_cis ? |
No, locally, like |
I totally agree with @bertsky. But I guess this should be discussed in a separate issue. Maybe even on ocrd_core? |
Right. See OCR-D/spec#160 |
pyrnn models are generally distributed gzipped. If loading gzipped models is inefficient, I can also adapt OCR-D/ocrd_all#103 to gunzip models after download.