Skip to content
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

这个错是因为模型有问题吗? #1

Open
lionel-xie opened this issue Aug 31, 2019 · 7 comments
Open

这个错是因为模型有问题吗? #1

lionel-xie opened this issue Aug 31, 2019 · 7 comments

Comments

@lionel-xie
Copy link

InvalidArgumentError: Incompatible shapes: [8,514,768] vs. [8,512,768]
[[{{node model_2/Embedding-Position/add}} = Add[T=DT_FLOAT, _class=["loc:@training/Adam/gradients/model_2/Embedding-Position/add_grad/Reshape"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](model_2/Embedding-Token-Segment/add, model_2/Embedding-Position/Tile)]]
[[{{node metrics/acc_top2/Mean_1/_3259}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_21926_metrics/acc_top2/Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

@finlay-liu
Copy link
Owner

把maxlen 改成510就可以了。

@Xw-Jia
Copy link

Xw-Jia commented Sep 6, 2019

你好,请问这个keras-bert可以自由修改seq长度吗?感觉这样就只能是512了。
另外我在训练时候发现每一折的时候epoch中batch个数不一致,三四十和1400+,不知道是哪里的问题..
谢谢。

@Xw-Jia
Copy link

Xw-Jia commented Sep 6, 2019

不好意思,第一个问题知道了,pad的时候选max已经是514了。傻了。
第二个关于epoch的batch个数还是没能找到答案。

@Xw-Jia
Copy link

Xw-Jia commented Sep 6, 2019

把maxlen 改成510就可以了。

另外,model.fit_generator中的steps_per_epoch的参数感觉应该是len(train_D)//batch_size啊,毕竟每一个生成器产生一个batch数据

@finlay-liu
Copy link
Owner

把maxlen 改成510就可以了。

另外,model.fit_generator中的steps_per_epoch的参数感觉应该是len(train_D)//batch_size啊,毕竟每一个生成器产生一个batch数据

对 这个step有问题。

@YunBAI-PSL
Copy link

情感分类中,DATA_LIST = np.array(DATA_LIST)这一步会报错ValueError: setting an array element with a sequence,因为DATA_LIST原本是‘字符串+array’的形式,因此就不能再array了,不知道这个问题怎么解决,有大佬指点一下吗/

@finlay-liu
Copy link
Owner

情感分类中,DATA_LIST = np.array(DATA_LIST)这一步会报错ValueError: setting an array element with a sequence,因为DATA_LIST原本是‘字符串+array’的形式,因此就不能再array了,不知道这个问题怎么解决,有大佬指点一下吗/

np.array(DATA_LIST, dtype=object)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants