Conversation
Both were found while reading through the code base and trying to bring the package up so the inference path could be followed end to end: `import ffn.inference.inference` failed with an IndentationError. Two files on master do not compile, and between them they make most of the package unimportable. ffn/training/tracker.py: 9af8e87 wrapped the font used to annotate the eval image summaries in a try/except, but the call in the try body was left commented out, so the block ended up empty. Anything that imports this file fails, which reaches the inference core through inference -> movement -> training.examples -> training.tracker. ffn/input/volume.py: 8c7fcb6 renamed config.sampling.bbox to config.sampling.bounding_boxes without re-indenting the block, leaving the `if` with no body. For tracker.py, the except clause catches (IOError, ValueError), which is the documented exception contract of PIL.ImageFont.truetype (OSError: the font file could not be read; ValueError: the size is not positive), so the line that was commented out loaded a specific font file. Neither that file nor its size can be recovered from the repository, which ships no font, so the fallback the except branch already used is kept. ImageDraw.text falls back to the same load_default() when handed no font, so rendering is unchanged.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reading through the repository to follow the inference path end to end, I could not
get the package to import from a clean checkout. Two files on master do not compile,
and between them they make most of the package unimportable.
ffn/training/tracker.py
9af8e87 wrapped the font used to annotate the eval image summaries in a
try/except,but left the call in the
trybody commented out, so the block is empty and themodule no longer parses.
import ffn.inference.inferenceraisesIndentationErrorbecause of it, through inference -> movement -> training.examples -> training.tracker.
The
exceptclause catches(IOError, ValueError), which is the documented exceptioncontract of
PIL.ImageFont.truetype(OSErrorif the font file cannot be read,ValueErrorif the size is not a positive number), so the commented-out line wasloading a specific font file. No font file is present in the repository and its path
and size cannot be recovered from it, so I kept the fallback that the
exceptbranchalready used.
ImageDraw.textcallsImageFont.load_default()when it is handed nofont, which is exactly what the
exceptbranch passed, so the rendered summaries areunchanged: both variants produce a byte-identical PNG.
ffn/input/volume.py
8c7fcb6 renamed
config.sampling.bboxtoconfig.sampling.bounding_boxes, and insample_coordinatesthe rename was made without re-indenting the block below it,leaving
if config.sampling.bounding_boxes:with no body and a 4-space indent insidean otherwise 2-space file. The second occurrence of the same check, further down the
file, was updated correctly.
Verification
With both changes
import ffn.inference.inferencesucceeds, andffn.inference.run_inferencebecomes importable. Of the 62 modules in the package, 46now import, against 38 before; the rest fail on their own missing optional
dependencies.
ffn/training/tracker_test.pypasses.