Skip to content

PEFT on Named Entity Recognition #1336

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

Merged
merged 4 commits into from
Feb 21, 2024
Merged

PEFT on Named Entity Recognition #1336

merged 4 commits into from
Feb 21, 2024

Conversation

Jemoka
Copy link
Member

@Jemoka Jemoka commented Jan 28, 2024

  • PEFT and training ops (wandb) updates for NER
  • optional two stage optimization (doesn't seem to help much)

depends on #1337 and #1338 (merged)

@Jemoka Jemoka requested a review from AngledLuffa January 28, 2024 08:40
@Jemoka Jemoka force-pushed the peft-ner branch 3 times, most recently from 08d15ca to 0fdd48b Compare January 28, 2024 18:11
@Jemoka Jemoka marked this pull request as draft January 28, 2024 18:23
@Jemoka Jemoka changed the title PEFT on Named Entity Recognition + TrainOps for Depparse & Coref PEFT on Named Entity Recognition Feb 21, 2024
@Jemoka Jemoka marked this pull request as ready for review February 21, 2024 17:22


# IMPORTANT: gradient checkpointing BREAKS peft if applied before
# 1. Apply PEFT FIRST (looksie! its above this line)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's

@@ -85,7 +111,10 @@ def __init__(self, args=None, vocab=None, pretrain=None, model_file=None, device
if pname.split('.')[0] not in exclude:
p.requires_grad = False
self.model = self.model.to(device)
self.optimizer = utils.get_optimizer(self.args['optim'], self.model, self.args['lr'], momentum=self.args['momentum'], bert_learning_rate=self.args.get('bert_learning_rate', 0.0))
if not second_optim:
self.optimizer = utils.get_optimizer(self.args['optim'], self.model, self.args['lr'], momentum=self.args['momentum'], bert_learning_rate=self.args.get('bert_learning_rate', 0.0), is_peft=bool(self.args.get("peft")))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are still using the old peft argument it appears

@@ -15,6 +15,9 @@
from stanza.models.ner.vocab import MultiVocab
from stanza.models.common.crf import viterbi_decode

from peft import get_peft_model_state_dict, set_peft_model_state_dict
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! one last thing. unless / until we've decided to make these required, we should hide these imports in the functions that use them. i can make that change

@AngledLuffa AngledLuffa merged commit 6b5b019 into dev Feb 21, 2024
@AngledLuffa AngledLuffa deleted the peft-ner branch February 21, 2024 22:26
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

Successfully merging this pull request may close these issues.

2 participants