Skip to content

Commit 232ea89

Browse files
Merge remote-tracking branch 'upstream/master' into ci/docs/add-mkdocs
2 parents eb5da0e + b703eae commit 232ea89

File tree

11 files changed

+80
-36
lines changed

11 files changed

+80
-36
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ combinations may also work.
209209

210210
|tensorflow-model-analysis |apache-beam[gcp]|pyarrow |tensorflow |tensorflow-metadata |tfx-bsl |
211211
|------------------------------------------------------------------------------------ |----------------|----------|-------------------|--------------------|----------|
212-
|[GitHub master](https://github.com/tensorflow/model-analysis/blob/master/RELEASE.md) | 2.47.0 | 10.0.0 | nightly (2.x) | 1.15.0 | 1.15.1 |
212+
|[GitHub master](https://github.com/tensorflow/model-analysis/blob/master/RELEASE.md) | 2.60.0 | 10.0.1 | nightly (2.x) | 1.16.1 | 1.16.1 |
213+
|[0.47.1](https://github.com/tensorflow/model-analysis/blob/v0.47.1/RELEASE.md) | 2.60.0 | 10.0.1 | 2.16 | 1.16.1 | 1.16.1 |
214+
|[0.47.0](https://github.com/tensorflow/model-analysis/blob/v0.47.0/RELEASE.md) | 2.60.0 | 10.0.1 | 2.16 | 1.16.1 | 1.16.1 |
213215
|[0.46.0](https://github.com/tensorflow/model-analysis/blob/v0.46.0/RELEASE.md) | 2.47.0 | 10.0.0 | 2.15 | 1.15.0 | 1.15.1 |
214216
|[0.45.0](https://github.com/tensorflow/model-analysis/blob/v0.45.0/RELEASE.md) | 2.47.0 | 10.0.0 | 2.13 | 1.14.0 | 1.14.0 |
215217
|[0.44.0](https://github.com/tensorflow/model-analysis/blob/v0.44.0/RELEASE.md) | 2.40.0 | 6.0.0 | 2.12 | 1.13.1 | 1.13.0 |

RELEASE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,38 @@
44

55
## Major Features and Improvements
66

7+
## Bug fixes and other Changes
8+
9+
## Breaking Changes
10+
11+
* Depends on `tensorflow>=2.17,<2.18`.
12+
* Depends on `protobuf>=4.25.2,<5` for Python 3.11 and on
13+
`protobuf>=4.21.6,<6.0.0` for 3.9 and 3.10.
14+
15+
## Deprecations
16+
17+
# Version 0.47.1
18+
19+
## Major Features and Improvements
20+
21+
* N/A
22+
23+
## Bug fixes and other Changes
24+
25+
* Removing addons from __init__.py as it's deprecated with Eval Saved Model.
26+
27+
## Breaking Changes
28+
29+
* N/A
30+
31+
## Deprecations
32+
33+
* N/A
34+
35+
# Version 0.47.0
36+
37+
## Major Features and Improvements
38+
739
* Adds `False{Negative,Positive}FeatureSampler` metrics.
840
* Adds `RecallAtFalsePositiveRate` metrics.
941
* Adds 'NegToNegFlipRate', 'NegToPosFlipRate', 'PosToNegFlipRate',
@@ -20,6 +52,8 @@
2052
* Remove keras_util_test.py which is based on estimator models.
2153
* Remove dependency on eval_saved_model encodings.
2254
* Downloads `punkt_tab` in Rouge metric.
55+
* Depends on `tensorflow 2.16`
56+
* Relax dependency on Protobuf to include version 5.x
2357

2458
## Breaking Changes
2559

docs/install.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ combinations may also work.
152152

153153
tensorflow-model-analysis | apache-beam[gcp] | pyarrow | tensorflow | tensorflow-metadata | tfx-bsl
154154
------------------------------------------------------------------------------------ | ---------------- | ------- | ------------- | ------------------- | -------
155-
[GitHub master](https://github.com/tensorflow/model-analysis/blob/master/RELEASE.md) | 2.47.0 | 10.0.0 | nightly (2.x) | 1.15.0 | 1.15.1
155+
[GitHub master](https://github.com/tensorflow/model-analysis/blob/master/RELEASE.md) | 2.60.0 | 10.0.1 | nightly (2.x) | 1.16.1 | 1.16.1
156+
[0.47.1](https://github.com/tensorflow/model-analysis/blob/v0.47.1/RELEASE.md) | 2.60.0 | 10.0.1 | 2.16 | 1.16.1 | 1.16.1
157+
[0.47.0](https://github.com/tensorflow/model-analysis/blob/v0.47.0/RELEASE.md) | 2.60.0 | 10.0.1 | 2.16 | 1.16.1 | 1.16.1
156158
[0.46.0](https://github.com/tensorflow/model-analysis/blob/v0.46.0/RELEASE.md) | 2.47.0 | 10.0.0 | 2.15 | 1.15.0 | 1.15.1
157159
[0.45.0](https://github.com/tensorflow/model-analysis/blob/v0.45.0/RELEASE.md) | 2.47.0 | 10.0.0 | 2.13 | 1.14.0 | 1.14.0
158160
[0.44.0](https://github.com/tensorflow/model-analysis/blob/v0.44.0/RELEASE.md) | 2.40.0 | 6.0.0 | 2.12 | 1.13.1 | 1.13.0

setup.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def _make_docs_packages():
263263
def _make_extra_packages_tfjs():
264264
# Packages needed for tfjs.
265265
return [
266-
'tensorflowjs>=4.5.0,<5',
266+
'tensorflowjs>=4.22.0,<5',
267267
]
268268

269269

@@ -314,30 +314,25 @@ def select_constraint(default, nightly=None, git_master=None):
314314
'numpy>=1.23.5',
315315
'pandas>=1.0,<2',
316316
'pillow>=9.4.0',
317-
'protobuf>=4.25.2,<5;python_version>="3.11"',
318-
'protobuf>=3.20.3,<5;python_version<"3.11"',
317+
'protobuf>=4.25.2,<6.0.0;python_version>="3.11"',
318+
'protobuf>=4.21.6,<6.0.0;python_version<"3.11"',
319319
'pyarrow>=10,<11',
320320
'rouge-score>=0.1.2,<2',
321321
'sacrebleu>=2.3,<4',
322322
'scipy>=1.4.1,<2',
323323
'six>=1.12,<2',
324-
'tensorflow'
325-
+ select_constraint(
326-
default='>=2.15,<2.16',
327-
nightly='>=2.16.0.dev',
328-
git_master='@git+https://github.com/tensorflow/tensorflow@master',
329-
),
324+
'tensorflow>=2.17,<2.18',
330325
'tensorflow-estimator>=2.10',
331326
'tensorflow-metadata'
332327
+ select_constraint(
333-
default='>=1.15.0,<1.16.0',
334-
nightly='>=1.16.0.dev',
328+
default='>=1.16.1,<1.17.0',
329+
nightly='>=1.17.0.dev',
335330
git_master='@git+https://github.com/tensorflow/metadata@master',
336331
),
337332
'tfx-bsl'
338333
+ select_constraint(
339-
default='>=1.15.1,<1.16.0',
340-
nightly='>=1.16.0.dev',
334+
default='>=1.16.1,<1.17.0',
335+
nightly='>=1.17.0.dev',
341336
git_master='@git+https://github.com/tensorflow/tfx-bsl@master',
342337
),
343338
],

tensorflow_model_analysis/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
# TODO(b/73882264): The orders should be kept in order to make benchmark on
6464
# DataFlow work. We need to look into why the import orders matters for the
6565
# DataFlow benchmark.
66-
from tensorflow_model_analysis import addons
6766
from tensorflow_model_analysis import extractors
6867
from tensorflow_model_analysis import slicer
6968
from tensorflow_model_analysis import validators

tensorflow_model_analysis/metrics/metric_util.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ def lookup(label):
909909
return np.array([lookup(l) for l in labels.flatten()]).reshape(labels.shape)
910910

911911

912-
def select_class_id(
912+
def select_class_id( # pytype: disable=annotation-type-mismatch
913913
class_id: int,
914914
labels: Any,
915915
predictions: Any,
@@ -983,9 +983,11 @@ def lookup(arr, target):
983983
predictions.reshape(predictions_out_shape))
984984

985985

986-
def _verify_sparse_labels(labels: np.ndarray,
987-
predictions: np.ndarray,
988-
sparse_labels: bool = None) -> bool:
986+
def _verify_sparse_labels(
987+
labels: np.ndarray, # pytype: disable=annotation-type-mismatch
988+
predictions: np.ndarray,
989+
sparse_labels: bool = None,
990+
) -> bool:
989991
"""Checks if labels are sparse or not.
990992
991993
Args:

tensorflow_model_analysis/notebook/jupyter/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tensorflow_model_analysis",
3-
"version": "0.47.0.dev",
3+
"version": "0.48.0.dev",
44
"homepage": "https://github.com/tensorflow/model-analysis",
55
"bugs": "https://github.com/tensorflow/model-analysis/issues",
66
"license": "Apache-2.0",

tensorflow_model_analysis/proto/config.proto

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,20 @@ message ModelSpec {
7070
map<string, string> label_keys = 6; // oneof not allowed with maps
7171
// Optional prediction key (single_output model). The prediction key is used
7272
// to distinguish between different values when the output from the predict
73-
// call is a dict instead of a single tensor as is the case with
74-
// tf.Estimators. If not set and the prediction is a dict, the keys 'scores',
75-
// 'logistic', 'predictions', or 'probabilities' are tried (in that order).
73+
// call is a dict instead of a single tensor. For estimator models, this is
74+
// always the case and the prediction key is automatically inferred -- the
75+
// keys 'scores', 'logistic', 'predictions', and 'probabilities' are tried
76+
// (in that order). For Keras models, outputs are typically not dicts but if
77+
// they are, then prediction key is not inferred and so MUST be specified.
78+
//
79+
// Note: For multi-class predictions, a prediction key needs to be specified
80+
// so that the metrics can be computed correctly per class.
81+
// TODO(b/399156775): Remove once the bug is fixed.
82+
//
7683
// The prediction key is also used in cases where the predictions are
77-
// pre-calculated and stored along side the features. In this case the
78-
// prediction key refers to a key in the features dictionary. Use one of
79-
// prediction_key or prediction_keys.
84+
// pre-calculated and stored along side the features (a model is not used).
85+
// In this case the prediction key refering to a key in the features
86+
// dictionary must be provided. Use one of prediction_key or prediction_keys.
8087
//
8188
// Note that prediction_key is NOT the same as the output_name used in the
8289
// MetricsSpec. The output_name refers to the name of an output for a
@@ -105,11 +112,6 @@ message ModelSpec {
105112
// Here 'head1' or 'head2' would be the output_name, whereas 'probabilities'
106113
// would be the prediction_key.
107114
//
108-
// If a model is not being used (i.e. the predictions are stored in the
109-
// inputs), then a prediction_key is required. However, if a model is being
110-
// used to compute the predictions a prediction_key typically is not needed
111-
// since all the default tf.Estimator values for the keys are handled by TFMA
112-
// and keras does not return multiple tensors for a given output.
113115
string prediction_key = 7;
114116
// Optional prediction keys (multi-output model) keyed by output_name. Use one
115117
// of prediction_key or prediction_keys. See comment under prediction_key on

tensorflow_model_analysis/utils/example_keras_model.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ def call(self, inputs):
6060
return tf.reshape(inputs, (1, 32))
6161

6262

63+
class Caster(keras.layers.Layer):
64+
"""A Keras layer that reshapes the input."""
65+
66+
def call(self, inputs):
67+
return tf.cast(inputs, tf.float32)
68+
69+
6370
def get_example_classifier_model(input_feature_key: str = LANGUAGE):
6471
"""Returns a Keras model for testing."""
6572
parser = ExampleCLassifierParser(input_feature_key)
@@ -85,6 +92,8 @@ def get_example_classifier_model(input_feature_key: str = LANGUAGE):
8592
parsed_example = parser(inputs)
8693
text_vector = text_vectorization(parsed_example)
8794
text_vector = Reshaper()(text_vector)
95+
# Cast to float32 so that data type is consistent for the dense layers.
96+
text_vector = Caster()(text_vector)
8897
output1 = dense1(text_vector)
8998
output2 = dense2(output1)
9099
return tf.keras.Model(inputs=inputs, outputs=output2)

tensorflow_model_analysis/utils/model_util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,8 @@ def get_feature_values_for_model_spec_field(
278278
batched_extracts[constants.TRANSFORMED_FEATURES_KEY]):
279279
transformed_features = batched_extracts[
280280
constants.TRANSFORMED_FEATURES_KEY]
281-
if len(model_specs) > 1 and transformed_features:
282-
if spec.name in transformed_features:
283-
transformed_features = transformed_features[spec.name]
281+
if transformed_features and spec.name in transformed_features:
282+
transformed_features = transformed_features[spec.name]
284283
transformed_features = transformed_features or {}
285284
else:
286285
transformed_features = {}

tensorflow_model_analysis/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
# Version string for this release of TFMA.
1717
# Note that setup.py reads and uses this version.
18-
VERSION = '0.47.0.dev'
18+
VERSION = '0.48.0.dev'

0 commit comments

Comments
 (0)