Here is a short PR regarding Finite Scalar Quantization, as it is implemented here. The goal is to 1) fix the bug in Issue #139 and 2) to clean the code for better ease of use.
Here are the main changes:
Fix:
unpacking of indices when no indices are returned.
Remove
the check regarding "is the input of image-type or not?" and keeping only the attribute channel_first to inform the type of shapes. This is more coherent with the use of the module, and simplify the reshaping of the input of the forward pass.
all helper functions are removed as they are not necessary and add a certain level of complexity.
Add
a dedicated and (almost) complete test suite for FSQ. The tests cover almost all the code now, in particular by testing many possible choices: with or without returning indices, images or sequences input, channel first or not, several codebooks or not, and so on.
a short paragraph and example in the README regarding the return_indices = False possibility.
a as exhaustive as possible documentation of the module, the FSQ module and the methods therein. In particular, some care has been taken regarding the shape expected for the different methods.
The whole code has been properly formatted and linting.
Here is a short PR regarding Finite Scalar Quantization, as it is implemented here. The goal is to 1) fix the bug in Issue #139 and 2) to clean the code for better ease of use.
Here are the main changes:
Fix:
indices
when no indices are returned.Remove
channel_first
to inform the type of shapes. This is more coherent with the use of the module, and simplify the reshaping of the input of the forward pass.Add
return_indices = False
possibility.The whole code has been properly formatted and linting.
Hope it will be reviewed :)