question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The new impl for CONFIG_MAPPING prevents users from adding any custom models

See original GitHub issue

Environment info

  • transformers version: 4.10+
  • Platform: Ubuntu 18.04
  • Python version: 3.7.11
  • PyTorch version (GPU?): N/A
  • Tensorflow version (GPU?): N/A
  • Using GPU in script?: N/A
  • Using distributed or parallel set-up in script?: No.

Who can help

Information

Model I am using (Bert, XLNet …): Custom model

The problem arises when using:

  • the official example scripts: (give details below)
  • my own modified scripts: (give details below)

The tasks I am working on is:

  • an official GLUE/SQUaD task: (give the name)
  • my own task or dataset: (give details below)

To reproduce

See: https://github.com/huggingface/transformers/blob/010965dcde8ce9526f6a7e6e2c3f36276c153708/src/transformers/models/auto/configuration_auto.py#L297

This was changed from the design in version 4.9 which used an OrderedDict instead of the new _LazyConfigMapping. The current design makes it so users cannot add their own custom models by assigning names and classes to the following registries (example: classification tasks):

  • CONFIG_MAPPING in transformers.models.auto.configuration_auto, and
  • MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING in transformers.models.auto.modeling_auto.

Expected behavior

Either a mechanism to add custom Configs (and the corresponding models) with documentation for it, or documentation for whatever other recommended method. Possibly that already exists, but I haven’t found it yet.

@sgugger

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
LysandreJikcommented, Oct 14, 2021

Hello @aleSuglia, @sgugger is working on that API here: https://github.com/huggingface/transformers/pull/13989

It should land in the next few days.

0reactions
aleSugliacommented, Oct 13, 2021

@sgugger @LysandreJik any updates on this? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arc: Regression issue when mapping @ConfigMapping using ...
Describe the bug This issue affects all users that provide a custom config source (org.eclipse.microprofile.config.spi.ConfigSource).
Read more >
Mapping configuration to objects - Quarkus
A config mapping requires an interface with minimal metadata configuration and annotated with the @io.smallrye.config.ConfigMapping annotation. ... The Server ...
Read more >
Core Features - Spring
This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use...
Read more >
Custom Resources - Kubernetes
Custom resources are extensions of the Kubernetes API. This page discusses when to add a custom resource to your Kubernetes cluster and when ......
Read more >
SOLID Design Principles Explained: The Open/Closed ...
All 5 SOLID design principles are broadly used, If you don't know them by name, you will quickly recognize that they describe the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found