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
12.17k stars 2.95k forks source link

[Question]: paddle serving RPC部署UIE模型,服务端已经成功,客户端请求服务端,提示输入的数据维度不正确,有了解的大神吗 #4005

Closed yangxuan14nlp closed 1 year ago

yangxuan14nlp commented 1 year ago

请提出你的问题

probuf 如下:

feed_var {
name: "input_ids"
alias_name: "input_ids"
is_lod_tensor: false
feed_type: 0
}
feed_var {
name: "token_type_ids"
alias_name: "token_type_ids"
is_lod_tensor: false
feed_type: 0
}
feed_var {
name: "pos_ids"
alias_name: "pos_ids"
is_lod_tensor: false
feed_type: 0
}
feed_var {
name: "att_mask"
alias_name: "att_mask"
is_lod_tensor: false
feed_type: 0
}
fetch_var {
name: "sigmoid_1.tmp_0"
alias_name: "sigmoid_1.tmp_0"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
fetch_var {
name: "sigmoid_2.tmp_0"
alias_name: "sigmoid_2.tmp_0"
is_lod_tensor: true
fetch_type: 1
shape: -1
}

client 请服务端的部分代码如下:

input_dict = {
"input_ids":
encoded_inputs['input_ids'][l:r].astype('int64'),
"token_type_ids":
encoded_inputs['token_type_ids'][l:r].astype('int64'),
"pos_ids":
encoded_inputs['position_ids'][l:r].astype('int64'),
"att_mask":
encoded_inputs["attention_mask"][l:r].astype('int64')
}
pprint(texts)
print(input_dict['input_ids'].shape, type(input_dict['input_ids'])) # shape = 1512
print(input_dict['token_type_ids'].shape, type(input_dict['token_type_ids'])) # shape = 1512
print(input_dict['pos_ids'].shape, type(input_dict['pos_ids'])) # shape = 1512
print(input_dict['att_mask'].shape, type(input_dict['att_mask'])) # shape = 1512
feed = input_dict#{"words": word_ids}
#fetch = ["layer_norm_12.tmp_2","gelu_1.tmp_0"]#["acc", "cost", "prediction"]
fetch = ["sigmoid_1.tmp_0", "sigmoid_2.tmp_0"] # ["acc", "cost", "prediction"]
fetch_map = client.predict(feed=feed, fetch=fetch, batch=False)

服务端报错,并退出!!
InvalidArgumentError: The first dimension value of Input(Scale) must equal to be thesecond dimension value of the flattened 2D matrix of Input(X),But received the first dimension value of Input(Scale) is[312], the second dimension value of the flattened 2D matrix of Input(Scale) is [159744].
[Hint: Expected ctx->GetInputDim("Scale")[0] == right, but received ctx->GetInputDim("Scale")[0]:312 != right:159744.] (at /paddle/paddle/fluid/oper ators/layer_norm_op.cc:72)
[operator < layer_norm > error]
Aborted (core dumped)

使用的是UIE nano; 我能了解到的是159744/512=312的字向量维度,但为何这样写服务端不支持了

linjieccc commented 1 year ago

@yangxuan14nlp Hi,

能否提供一份最小可复现代码,另外可以check下max_seq_len的设置

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。