Giter Club home page Giter Club logo

Comments (6)

wangxicoding avatar wangxicoding commented on May 18, 2024

max_seq_len指的是seq最大长度为max_seq_len。假如max_seq_len=256:
在padding的时候,如果一个batch内样本最大长度为300,则所有样本会截取padding到256;
如果一个batch内样本最大长度为200,则所有样本会padding到200。

max_seq_len只是限制最大seq_len,当batch内样本长 < max_seq_len 则按照样本最大长度,否则就截取到max_seq_len。
ernie_pyreader读取不同batch时支持seq_len变化,不会有影响。

from paddlenlp.

zhangxuanaj avatar zhangxuanaj commented on May 18, 2024

max_seq_len指的是seq最大长度为max_seq_len。假如max_seq_len=256:
在padding的时候,如果一个batch内样本最大长度为300,则所有样本会截取padding到256;
如果一个batch内样本最大长度为200,则所有样本会padding到200。

max_seq_len只是限制最大seq_len,当batch内样本长 < max_seq_len 则按照样本最大长度,否则就截取到max_seq_len。
ernie_pyreader读取不同batch时支持seq_len变化,不会有影响。

def ernie_pyreader(args, pyreader_name):
"""define standard ernie pyreader"""
src_ids = fluid.data(
name='1', shape=[-1, args.max_seq_len, 1], dtype='int64')
sent_ids = fluid.data(
name='2', shape=[-1, args.max_seq_len, 1], dtype='int64')
pos_ids = fluid.data(
name='3', shape=[-1, args.max_seq_len, 1], dtype='int64')
input_mask = fluid.data(
name='4', shape=[-1, args.max_seq_len, 1], dtype='float32')

ernie_pyreader里要求数据seq_len为args.max_seq_len

from paddlenlp.

wangxicoding avatar wangxicoding commented on May 18, 2024

这个不影响pyreader对数据的读入和后面网络的运行,运行时会根据真实的shape来跑

from paddlenlp.

zhangxuanaj avatar zhangxuanaj commented on May 18, 2024

这个不影响pyreader对数据的读入和后面网络的运行,运行时会根据真实的shape来跑


Error Message Summary:

InvalidArgumentError: The fed Variable src_ids should have dimensions = 3, shape = [-1, 256, 1], but received fed shape [4, 191, 1]

运行报这个错了

from paddlenlp.

wangxicoding avatar wangxicoding commented on May 18, 2024

参考一下这个PR PaddlePaddle/models#4790

from paddlenlp.

songzy12 avatar songzy12 commented on May 18, 2024

PaddlePaddle/models#4790 解决了这个问题,应该可以关闭当前 issue?

from paddlenlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.