-
Notifications
You must be signed in to change notification settings - Fork 45.8k
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
Made api's compatible with python3.7+ #11259
base: master
Are you sure you want to change the base?
Conversation
Hi @yeqingli, @lehougoogle, @Chen-Zhe, could you please review the PR. Thank You |
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.
Thanks for the fix. Please updates the something | None
to Optional[something]
.
@@ -33,7 +34,7 @@ class BaseTwoTowerUpliftNetwork(tf_keras.layers.Layer, metaclass=abc.ABCMeta): | |||
def call( | |||
self, | |||
inputs: types.DictOfTensors, | |||
training: bool | None = None, | |||
mask: tf.Tensor | None = None, | |||
training: Union[bool, None] = None, |
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 think Union[something | None]
is equivalent to Optional[something]
. Could you update here and all the other places if applicable.
official/vision/modeling/factory.py
Outdated
@@ -263,8 +263,8 @@ def build_retinanet( | |||
l2_regularizer: Optional[tf_keras.regularizers.Regularizer] = None, | |||
backbone: Optional[tf_keras.Model] = None, | |||
decoder: Optional[tf_keras.Model] = None, | |||
num_anchors_per_location: int | dict[str, int] | None = None, | |||
anchor_boxes: Mapping[str, tf.Tensor] | None = None, | |||
num_anchors_per_location: Union[int, Dict[str, int], None] = None, |
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.
Can this Union[int, Dict[str, int], None]
be Optional[Union[int, Dict[str, int]]]
export_dir: str, | ||
checkpoint_path: Optional[str] = None, |
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.
Can you keep the original order of arguments by moving checkpoint_path
before export_dir
?
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.
Updated the suggested changes.
num_scales: int | None, | ||
aspect_ratios: list[float] | None, | ||
anchor_size: float | None, | ||
min_level: Optional[int] = None, |
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.
Can you keep the original order of arguments?
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.
Updated the suggested changes.
|
||
from official.core.config_definitions import base_config | ||
|
||
|
||
@dataclasses.dataclass(kw_only=True) | ||
@dataclasses.dataclass |
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.
Is there a specific reason to remove kw_only=True
?
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.
To keep the code more flexible, simple by allowing positional arguments to define attributes for SlicedMetricConfig.
Description
Reference github issue #11247 #11256
Type of change
For a new feature or function, please create an issue first to discuss it
with us before submitting a pull request.
Note: Please delete options that are not relevant.
Tests
Test Configuration:
Checklist