-
Notifications
You must be signed in to change notification settings - Fork 34
[Feature] Add BERT SWAG Multiple Choice application (Ref: #ID9IPX) #31
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: dev
Are you sure you want to change the base?
[Feature] Add BERT SWAG Multiple Choice application (Ref: #ID9IPX) #31
Conversation
运行出错:ValueError Traceback (most recent call last) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:826, in Module._wrapped_call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:840, in Module._call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py:1605, in BertForMultipleChoice.forward(self, input_ids, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:826, in Module._wrapped_call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:840, in Module._call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py:936, in BertModel.forward(self, input_ids, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, encoder_hidden_states, encoder_attention_mask, past_key_values, use_cache, output_attentions, output_hidden_states, return_dict, cache_position) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:826, in Module._wrapped_call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:840, in Module._call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py:179, in BertEmbeddings.forward(self, input_ids, token_type_ids, position_ids, inputs_embeds, past_key_values_length) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:826, in Module._wrapped_call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/module.py:840, in Module._call_impl(self, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/modules/sparse.py:192, in Embedding.forward(self, input) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/nn/functional.py:184, in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/executor.py:6, in execute(func_name, *args, **kwargs) File /usr/local/python3.10.14/lib/python3.10/site-packages/mindtorch/dispatcher.py:42, in Dispatcher.dispatch(self, func_name, *args, **kwargs) ValueError: All tensor arguments must be on the same device. |
…nto feature/bert-swag-multiple-choice
|
已修复问题并且修改格式,请重写测试。 |
|
MindSpore 2.7.0和MindSpore NLP 0.5.1版本可以运行 |
Purpose: Added a new NLP application case for Multiple Choice tasks using BERT on the SWAG dataset.
Issue: Ref: #ID9IPX
Approach: Implemented using MindSpore 2.7.1 and Mindhf 0.6.0
Changes
Added applications/nlp/multiple_choice/swag_bert_run_result.ipynb.
Updated applications/nlp/README.md to include the new case in the application list.
Inference demo runs successfully on 910B2.
ref:https://gitee.com/mindspore/community/issues/ID9IPX