microsoft / TransformerCompression

For releasing code related to compression methods for transformers, accompanying our publications
MIT License
364 stars 36 forks source link

Add more abstract properties to model adapter #79

Closed pashminacameron closed 9 months ago

pashminacameron commented 9 months ago

Last of the remaining changes from #71

A potential mistake in an implementation of the ModelAdapter and LayerAdapter interface will now lead to a unique error message, so that the user can rectify the issue. The interface now follows the ABC concept strictly and the differences between different model implementations are purely due to model differences. There is no extra boiler plate of member variable storage required.

A bit of a circuitous journey, but hopefully worthwhile. An alternative way to review this PR is to get this branch and look at the file diffs for any two implementations and a diff between the interface and an implementation.

Should be merged after #77 and #78 with a rebase on the main at that point. #75 will benefit from having this as the base to work on (happy to fix that branch for the layer/model adapter changes).