PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
11.97k stars 2.91k forks source link

ValueError: (InvalidArgument) Tensor holds the wrong type, it holds int, but desires to be int64_t. #2112

Closed GMfatcat closed 2 years ago

GMfatcat commented 2 years ago

看了下issue,發現這個好像是paddleNLP在windows老問題。在Seq2Seq對聯生成的範例中出現這個情況

image

Example Code 今天早上剛剛clone下來,paddleNLP版本2.2.6

感覺問題還是出在np array window 默認 int32 非 int64,做了以下改動後還是出現錯誤 image

請問如何解決?

GMfatcat commented 2 years ago

@LiuChiachi 請問問題有解決嗎?

LiuChiachi commented 2 years ago

https://github.com/PaddlePaddle/PaddleNLP/blob/a389a72c56e4445e74405b0716a99989cdc5d3a3/examples/text_generation/couplet/data.py#L75

    tgt, tgt_length = Pad(pad_val=pad_id, ret_length=True, dtype="int64")(
        [inst[1] for inst in insts])

建议Pad()里面指定dtypeint64这样试一下,另一个非常类似的例子是这样修复的,#1198, #1216

GMfatcat commented 2 years ago

加上就可以train了