Skip to content

fix bug unimo fp16 infer error #4166

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

Merged
merged 4 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions applications/text_summarization/unimo-text/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import argparse
import os
from pprint import pprint

import paddle

from pprint import pprint

from paddlenlp.transformers import UNIMOLMHeadModel, UNIMOTokenizer
from paddlenlp.ops import FasterUNIMOText

from paddlenlp.transformers import UNIMOLMHeadModel, UNIMOTokenizer
from paddlenlp.utils.log import logger


Expand Down Expand Up @@ -82,13 +80,13 @@ def do_predict(args):
unimo_text,
input_spec=[
# input_ids
paddle.static.InputSpec(shape=[None, None], dtype="int32"),
paddle.static.InputSpec(shape=[None, None], dtype="int64"),
# token_type_ids
paddle.static.InputSpec(shape=[None, None], dtype="int32"),
paddle.static.InputSpec(shape=[None, None], dtype="int64"),
# attention_mask
paddle.static.InputSpec(shape=[None, 1, None, None], dtype="float32"),
# seq_len
paddle.static.InputSpec(shape=[None], dtype="int32"),
paddle.static.InputSpec(shape=[None], dtype="int64"),
args.max_out_len,
args.min_out_len,
args.topk,
Expand Down
14 changes: 6 additions & 8 deletions examples/question_generation/unimo-text/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import argparse
import os
from pprint import pprint

import paddle

from pprint import pprint

from paddlenlp.transformers import UNIMOLMHeadModel, UNIMOTokenizer
from paddlenlp.ops import FasterUNIMOText

from paddlenlp.transformers import UNIMOLMHeadModel, UNIMOTokenizer
from paddlenlp.utils.log import logger


Expand Down Expand Up @@ -70,19 +68,19 @@ def do_predict(args):
paddle.static.InputSpec(shape=[None, None], dtype="int64"),
# attention_mask
paddle.static.InputSpec(shape=[None, 1, None, None],
dtype="float64"),
dtype="float32"),
# seq_len
paddle.static.InputSpec(shape=[None], dtype="int64"),
args.max_dec_len,
args.min_dec_len,
args.topk,
args.topp,
args.num_beams, # num_beams. Used for beam_search.
args.num_beams, # num_beams. Used for beam_search.
args.decoding_strategy,
tokenizer.cls_token_id, # cls/bos
tokenizer.mask_token_id, # mask/eos
tokenizer.pad_token_id, # pad
args.diversity_rate, # diversity rate. Used for beam search.
args.diversity_rate, # diversity rate. Used for beam search.
args.temperature,
args.num_return_sequences,
args.length_penalty,
Expand Down