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

segment_ids 有什么用呢 #484

Open
FortuneStar opened this issue Jul 18, 2022 · 2 comments
Open

segment_ids 有什么用呢 #484

FortuneStar opened this issue Jul 18, 2022 · 2 comments

Comments

@FortuneStar
Copy link

token_ids, segment_ids = tokenizer.encode(d['text'], maxlen=maxlen)
这句代码中返回值中的segment_ids,我分析了一下源码,大概是这个意思,句子A和句子B分隔符,句子A对应的全为0,句子B对应的全为1。但是不知道有什么用,可能我问的问题比较肤浅(´・_・`),之前用huggingface里面的bert,返回值貌似是没有这项的。

@bojone
Copy link
Owner

bojone commented Jul 21, 2022

token_ids, segment_ids = tokenizer.encode(d['text'], maxlen=maxlen) 这句代码中返回值中的segment_ids,我分析了一下源码,大概是这个意思,句子A和句子B分隔符,句子A对应的全为0,句子B对应的全为1。但是不知道有什么用,可能我问的问题比较肤浅(´・_・`),之前用huggingface里面的bert,返回值貌似是没有这项的。

bert的返回值是没有的,bert的输入值有啊,这就是bert自带的设计,初衷是想要区分两个拼接的句子。

@liyunhan
Copy link

token_ids, segment_ids = tokenizer.encode(d['text'], maxlen=maxlen) 这句代码中返回值中的segment_ids,我分析了一下源码,大概是这个意思,句子A和句子B分隔符,句子A对应的全为0,句子B对应的全为1。但是不知道有什么用,可能我问的问题比较肤浅(´・_・`),之前用huggingface里面的bert,返回值貌似是没有这项的。

bert的返回值是没有的,bert的输入值有啊,这就是bert自带的设计,初衷是想要区分两个拼接的句子。

请问苏神bert4keras最高就支持tensorflow2.3以下版本吗

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

3 participants