-
Notifications
You must be signed in to change notification settings - Fork 322
Add support for DebertaV2ForSequenceClassification #746
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
base: main
Are you sure you want to change the base?
Conversation
|
Comparions from my Mac |
kozistr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave a quick review! Great work!
| (Config::DebertaV2(config), Device::Cpu | Device::Metal(_)) => { | ||
| tracing::info!("Starting DebertaV2 model on {:?}", device); | ||
| Ok(Box::new(DebertaV2Model::load(vb, &config, model_type).s()?)) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding CUDA support too?
|
|
||
| let scale = { | ||
| let q_size = query_layer.dim(D::Minus1)?; | ||
| Tensor::new(&[(q_size * scale_factor) as f32], &self.device)?.sqrt()? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about creating the scale tensor in load() function (I guess that the q_size is equal to all_head_size), and then only multiplying scale_factor to scale in forward() to reduce the tensor creation time?
What does this PR do?
This PR adds support for the DebertaV2SequenceClassification model, effectively closing #354 #281 #199
Shoutout to @kozistr for providing an initial set of reviews.
I have verified that outputs are identical on my Mac. I could use some help testing this on a CUDA machine if anyone can help out!
Fixes #354 #281 #199
PSA: The vast majority of this code has been borrowed from the great work done by @BradyBonnette in huggingface/candle#2743 <3
Before submitting
instasnapshots?Who can review?
@Narsil @alvarobartt @kozistr