-
Notifications
You must be signed in to change notification settings - Fork 296
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
Using jiant to make BioBERT and SciBERT to run superGLUE tasks #1306
Comments
I think either fine-tuning with transformers or using What tasks are you planning on running? The following notebook is an example of how to fine tune tasks currently supported by List of supported tasks: https://github.com/nyu-mll/jiant/blob/master/guides/tasks/supported_tasks.md |
Thank you very much Jesse for the prompt reply! Yeah, I think using jiant will definitely save us lots of code and time. For the mllu course project, we aim to measure the degree to which using a different pre-training corpus would change that affect both in terms of the amount of bias learned and used in downstream applications but also what is the tradeoff with actual pure NLU performance. I am planning to run BERT, RoBERTa, BioBERT, and SciBERT on ALL SuperGLUE tasks, because I don't think there is a way to clearly say apriori which tasks would be best at discriminating the models. Back to my question. I guess the main issue here is that I'd better finish the tasks by the end of this week because there will be a partial draft due next Thursday, so I am afraid I will not be able to use your amazing new feature :(. However, by looking at your notebook examples, I think I can also use the current main branch of jiant right? by loading different models in line say MODEL_TYPE = "roberta-base". Or did I miss anything? Again, thank you very much. And it would be much appreciated if I could ask more follow-up questions during the process (I am planning to install jiant on NYU greene and run the tasks). @jeswan edit: sorry I accidentally removed myself as an assignee for this thread. If you need it, please reassign me (I guess that's how you keep track of the issues?) Thank you so much. @jeswan |
export_model.export_model(
hf_pretrained_model_name_or_path="allenai/scibert_scivocab_cased",
output_base_path="./models/scibert",
) In the subsequent steps, you will need to modify I previously assigned the issue to you to notify you that I required your feedback. For now, I'll close this issue but please reopen the issue and comment if you have more questions. |
Thank you very much for the resource. I would like to quickly follow up tho. When you mentioned "to modify jiant", did you mean we need to somehow modify the source code of jiant, after we install jiant on Greene HPC? Or do we just need to modify, say, the example notebook to make sure all configs are correct for each model and task? edit: Or maybe I just install the feature branch? |
Modify the source code. However, if you use the feature branch above (should be merged into master within a week), you should not need to modify the source code. |
Thank you. Thanks again. |
Please use |
Thanks for the prompt reply! |
Dear Jesse, Update: Sorry I think I was confused! So previously you actually meant the feature branch IS WORKING right? I just need to download that branch not the master... So I don't need to wait till it merged to main. Update: I was working on the easy_add_model feature branch just using Simple API. However, it seems like the data path was not compatible with the current master branch. Here are the details: Downloading the data and model seems good: However, right before it starts to tokenize: I have an error: So it seems like somewhere the path gets concatenated twice? I am trying to locate which files are deprecated. If this sounds/looks familiar to you, any pointer would be appreciated. Thank you so much! |
Hey! I just saw the easy_add_model branch is in the PR. Congrats! @jeswan Thank you so much! |
@gokejian I will try BioBert with the PR branch to try and replicate the above error! |
@gokejian Fixed the issue and will push the fix to the # Remove forward slashes so RUN_NAME can be used as path
MODEL_NAME = HF_PRETRAINED_MODEL_NAME.split("/")[-1]
RUN_NAME = f"simple_{TASK_NAME}_{MODEL_NAME}" |
Ah, I know what is going on here. I'll push a fix for this shortly (need to add num_labels property to the Task object or slightly change how that label is used). |
Cool thanks! BTW all tasks inherit the Task object right? Is it possible for a local fix? I am trying to download the updated feature branch of |
Local fix: Change line 89 in heads.py to |
I'll also fix this :) Another task required the switch back to slow tokenizers but it looks like fast tokenizers are still referenced. |
Thanks! so if local fixes are possible please let me know. Otherwise, I will download the latest checkpoint. |
Can you try the HEAD of the feature branch? I was not able to replicate your issue with the latest commit. |
Oh my bad. Yes, the current HEAD is working fine. Thanks. |
* Update to Transformers v4.3.3 (#1266) * use default return_dict in taskmodels and remove hidden state context manager in models. * return hidden states in output of model wrapper * Switch to task model/head factories instead of embedded if-else statements (#1268) * Use jiant transformers model wrapper instead of if-else. Use taskmodel and head factory instead of if-else. * switch to ModelArchitectures enum instead of strings * Refactor get_output_from_encoder() to be member of JiantTaskModel (#1283) * refactor getting output from encoder to be member function of jiant model * switch to explicit encode() in jiant transformers model * fix simple runscript test * update to tokenizer 0.10.1 * Add tests for flat_strip() (#1289) * add flat_strip test * add list to test cases flat_strip * mlm_weights(), feat_spec(), flat_strip() if-else refactors (#1288) * moves remaining if-else statments to jiant model or replaces with model agnostic method * switch from jiant_transformers_model to encoder * fix bug in flat_strip() * Move tokenization logic to central JiantModelTransformers method (#1290) * move model specific tokenization logic to JiantTransformerModels * implement abstract methods for JiantTransformerModels * fix tasks circular import (#1296) * Add DeBERTa (#1295) * Add DeBERTa with sanity test * fix tasks circular import * [WIP] add deberta tests * Revert "fix tasks circular import" This reverts commit f924640. * deberta tests passing with transformers 6472d8 * switch to deberta-v2 * fix get_mlm_weights_dict() for deberta-v2 * update to transformers 4.5.0 * mark deberta test_export as slow * Update test_tokenization_normalization.py * add guide to add a model * fix test_expor_model tests * minor pytest fixes (add num_labels for rte, overnight flag fix) * bugfix for simple api notebook * bugfix for #1310 * bugfix for #1306: simple api notebook path name * squad running * 2nd bugfix for #1310: not all tasks have num_labels property * simple api notebook back to roberta-base * run test matrix for more steps to compare to master * save last/best model test fix Co-authored-by: Jesse Swanson <js11133Wnyu.edu>
Hi,
As always, thank you for this amazing contribution.
I am taking prof.bowman's class and attempting to run BioBERT https://github.com/dmis-lab/biobert-pytorch and SciBERT https://github.com/allenai/scibert on jiant. One of our objectives for the course project is to run BioBERT and SciBERT on common NLU tasks.
As far as I understand, it should be possible to add any Transformers encoder model to jiant, but both of those models will probably require a bit of code?
I am sketching out what I'd have to do in jiant vs. plain transformers. Will using jiant create more overheads (by trying to support those models) than just following the standard fine-tuning processes in transformers?
Any suggestions and pointers will be helpful. Thank you!
The text was updated successfully, but these errors were encountered: