Please delete the backend not involved / 请删除不涉及的后端:
/device ascend
Software Environment / 软件环境 (Mandatory / 必填):
-- MindSpore 2.3.1
-- Python 3.9.20
-- OS platform and distribution (e.g., Linux Ubuntu 16.04): ky10.aarch64
To Reproduce / 重现步骤 (Mandatory / 必填)
Steps to reproduce the behavior:
import mindspore as ms
import numpy as np
from mindspore import Tensor
from mindnlp.transformers import BertTokenizer
from mindnlp.transformers import BertForSequenceclassification, BertModel
path='/home/kw/huggingface/bert-base-uncased/'
model = BertForsequenceclassification.from pretrained(path, num labels=9, ignore mismatched sizes=True)
print(type(model))
tokenizer =BertTokenizer.from pretrained(path)
text ='hello, mindnlp'
inputs = tokenizer(text, padding='max length', truncation=True, max length=128)
print( inputs )
ms .export(model, *inputs,'file name='model',file format='MINDIR')
Screenshots/ 日志 / 截图 (Mandatory / 必填)
If applicable, add screenshots to help explain your problem.
Additional context / 备注 (Optional / 选填)
Add any other context about the problem here.
Describe the bug/ 问题描述 (Mandatory / 必填) A clear and concise description of what the bug is.
BertForSequenceclassification模型用mindspore.export方法导出失败
Hardware Environment(
Ascend
/GPU
/CPU
) / 硬件环境:Software Environment / 软件环境 (Mandatory / 必填): -- MindSpore 2.3.1 -- Python 3.9.20 -- OS platform and distribution (e.g., Linux Ubuntu 16.04): ky10.aarch64
To Reproduce / 重现步骤 (Mandatory / 必填) Steps to reproduce the behavior:
Screenshots/ 日志 / 截图 (Mandatory / 必填) If applicable, add screenshots to help explain your problem.
Additional context / 备注 (Optional / 选填) Add any other context about the problem here.
看了一下mindspore的源码,这里导出过程中要验证net是types.FunctionType或者type.MethodType,没有看懂