Skip to content

Conversation

@Rocketknight1
Copy link
Member

Should fix issues with saving/loading Keras models containing Transformers models as layers, among other problems.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean, I like it!

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice, clean fix.

@LysandreJik
Copy link
Member

It would be ideal to add tests to ensure that the model's serialization works correctly.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you, @Rocketknight1

@Rocketknight1 Rocketknight1 merged commit 4c35c8d into master Nov 11, 2021
@Rocketknight1 Rocketknight1 deleted the add_get_config branch November 11, 2021 14:21
@Zahlii
Copy link
Contributor

Zahlii commented Nov 11, 2021

Just a small comment from my side - I think I stumbled across the problem that the returned get_config was not fully JSON serializable (as it contained a reference to a tf DType class) - I circumvented this by adding a custom JSONEncoder for it; but it may be worthwhile testing for json.dumps(config) as well?

@Rocketknight1
Copy link
Member Author

Rocketknight1 commented Nov 15, 2021

@Zahlii That's a great idea! Would you be willing to write a test for it, or modify the existing test, and tag me for review?

@Zahlii
Copy link
Contributor

Zahlii commented Nov 16, 2021

See #14415

LysandreJik pushed a commit that referenced this pull request Nov 16, 2021
…ds (#14361)

* Experimenting with adding proper get_config() and from_config() methods

* Adding a test for get/from config

* Fix test for get/from config
LysandreJik pushed a commit that referenced this pull request Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

model.save() does not save keras model that includes DIstillBert layer

5 participants