Skip to content

DistributionStrategy and Keras models: support for sample_weight_mode #24226

@pawarrick

Description

@pawarrick

System information

  • TensorFlow version (you are using): master (Nov. 30, 2018)
  • Are you willing to contribute it (Yes/No): Yes

Describe the feature and the current behavior/state.
When using a DistributionStrategy with a Keras model that includes sample_weights, a 'NotImplemented' exception is thrown. For example,

   strategy = mirrored_strategy.MirroredStrategy()
    model.compile(loss='categorical_crossentropy',
                    optimizer=opt,
                    metrics=['accuracy'],
                    weighted_metrics=['accuracy'],
                    sample_weight_mode='temporal',
                    distribute=strategy)

The exception originates in tensorflow/python/keras/engine/training.py

 if sample_weight_mode:
	        raise NotImplementedError('sample_weight_mode is not supported with '
	                                  'DistributionStrategy.')

Can this be supported or can you give an estimated timeline?

Many thanks

Will this change the current api? How?
No. It looks like the API should support this.

Who will benefit with this feature?
Anyone using keras models with sample_weights in a DistributedStrategy mode.

Any Other info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp:dist-stratDistribution Strategy related issuesstaleThis label marks the issue/pr stale - to be closed automatically if no activitystat:contribution welcomeStatus - Contributions welcometype:featureFeature requests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions