mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Add functools.wraps for wrapper initializer
Preserve the original initializer function's metadata. See https://docs.python.org/3/library/functools.html#functools.update_wrapper
This commit is contained in:
parent
d262a5d48e
commit
a355f4f0fc
@ -14,8 +14,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""TF general model utils."""
|
||||
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
|
||||
@ -54,6 +53,7 @@ def keras_serializable(cls):
|
||||
if config_class is None:
|
||||
raise AttributeError("Must set `config_class` to use @keras_serializable")
|
||||
|
||||
@functools.wraps(initializer)
|
||||
def wrapped_init(self, config, *args, **kwargs):
|
||||
if isinstance(config, dict):
|
||||
config = config_class.from_dict(config)
|
||||
|
Loading…
Reference in New Issue
Block a user