Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electra w/Sequence classification? #413

Open
jondot opened this issue Sep 10, 2023 · 4 comments
Open

Electra w/Sequence classification? #413

jondot opened this issue Sep 10, 2023 · 4 comments

Comments

@jondot
Copy link
Contributor

jondot commented Sep 10, 2023

I've been reading the code, but unsure if sequence classification is supported in some undocumented way with ELECTRA?

@guillaume-be
Copy link
Owner

Hello @jondot ,

You are correct this is currently missing. It is probably straightforward to add and I could publish an update, unless you would like to work on this?

@jondot
Copy link
Contributor Author

jondot commented Sep 10, 2023

I haven't yet studied the mechanics of implementing such a thing, I can't manage to keep up (just learned about ELECTRA's existence via a model I need to use), I'm wondering if this is something you can point some learning material for me and I'd have a high chances of success?

@jondot
Copy link
Contributor Author

jondot commented Sep 11, 2023

@guillaume-be from what I could study from the code, having a TokenClassifier already -- I would just copy it and change the copied structs and such to SequenceClassfier, the rest is again just copying around, there's no new logic that separates a Token and Sequence classifier other than the stuff in the pipeline. Inside the models it's all similar.
So having that Electra has a token classifier, the job is already done for the sequence classifier. Is that a correct assumption?

@guillaume-be
Copy link
Owner

I would recommend checking a combination of the following resources:

  • The Python implementation for ElectraForSequenceClassification. This shows you need to implement a ElectraClassificationHead submodule.
  • A SequenceClassification model implementation in this crate such as DebertaV2ForSequenceClassification. This will give some high level guidance on how to create a new Struct with submodules as needed to reflect the Python implementation.

If you have a candidate model that is useful it would also be great to publish these weights and register them in the pretrained models -- this would allow adding a test for your implementation

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

No branches or pull requests

2 participants