Git Product home page Git Product logo

Comments (29)

supergyz avatar supergyz commented on June 22, 2024 1

我用您的代码跑了一下数据,eval accuracy 只有0.1,predict 的结果并没有图片中的80%那么高?

没有shuffle数据的原因 @yun97 @hxs91

from bert-classification-tutorial.

supergyz avatar supergyz commented on June 22, 2024 1

@jotline 两个原因。你看下data下的数据,第一行其实是噪音建议删去,稍微修改下_create_examples函数。因为如果先shuffle的话,第一行会被当成训练数据进去,更糟糕的是会多了个label变成11分类。第二个就加大步长,原文中写的是3000多步,也就是100epochs;我跑到1000步最高达到0.71,之后就没试过了。

from bert-classification-tutorial.

JepsonWong avatar JepsonWong commented on June 22, 2024 1

@hxs91 这个10分类的数据集跑了吗;我觉着上面谁跑到0.8的都是自己的数据集,不是这个1000行10分类数据集的结果。。。

我跑到了,不知道跑的对不对,但肯定没有用自己的数据集。
命令是
python3 run_classifier.py --data_dir=./data --vocab_file=./uncased_L-12_H-768_A-12/vocab.txt --bert_config_file=./uncased_L-12_H-768_A-12/bert_config.json --init_checkpoint=./uncased_L-12_H-768_A-12/bert_model.ckpt --output_dir=./output

from bert-classification-tutorial.

hxs91 avatar hxs91 commented on June 22, 2024

我也是,按照这个思路跑出来感觉不对劲。。

from bert-classification-tutorial.

jotline avatar jotline commented on June 22, 2024

然而shuf之后也只有0.58的eval_accuracy.
image

from bert-classification-tutorial.

jotline avatar jotline commented on June 22, 2024

@supergyz 好的,十分感谢🙏。我再试试看

from bert-classification-tutorial.

jotline avatar jotline commented on June 22, 2024

@supergyz 我跑了30000步,仍然是0.66左右。我估摸着数据有点少,导致测试集准确度太低。我换了一个6分类的场景,可以达到0.84的acc
image

from bert-classification-tutorial.

h123c avatar h123c commented on June 22, 2024

我开始也是0.1,看到上面的讨论才反应过来,只是对数据去掉第一行并shuffle后变为79%,可能会有浮动.

from bert-classification-tutorial.

yun97 avatar yun97 commented on June 22, 2024

@supergyz 非常感谢!

from bert-classification-tutorial.

jotline avatar jotline commented on June 22, 2024

@supergyz 可以直接跑一下官方的run_classifier.py,多加一些trainset的规模80%不难,我用我自己的数据集可以跑到挺高。

from bert-classification-tutorial.

sportzhang avatar sportzhang commented on June 22, 2024

@jotline 你用的英文还是中文?

from bert-classification-tutorial.

h123c avatar h123c commented on June 22, 2024

@h123c 你好,run_classifier的代码能发给我下吗。。刚才试了下还是0.66。。有点绝望。。

就是这里的原码,没有动,但是数据集处理了一下

from bert-classification-tutorial.

sportzhang avatar sportzhang commented on June 22, 2024

shuffle之后,跑到0.81是没什么问题的。

from bert-classification-tutorial.

jotline avatar jotline commented on June 22, 2024

@jotline 你用的英文还是中文?

我的数据集还比较复杂,有英文有中文,还有其他语言。

from bert-classification-tutorial.

jotline avatar jotline commented on June 22, 2024

@supergyz 我感觉是数据不太够?我跑的自己的多语种数据集,代码没有变,可以跑很高。后来没用tf版的bert了,pytorch版非常好用,速度也快。

from bert-classification-tutorial.

sportzhang avatar sportzhang commented on June 22, 2024

@supergyz 我是shuffle了一个与数据等长的list,然后分别对每个字段按照shuffle后的listc重排,参数没有改动。

from bert-classification-tutorial.

hxs91 avatar hxs91 commented on June 22, 2024

的确需要做shuffle,我之前以为代码中是有做shuffle的…在processor的_create_esamples中对examples做一下shuffle即可。我的实验(200+个类别文本分类)上结果从14%提升到91.7%

from bert-classification-tutorial.

hxs91 avatar hxs91 commented on June 22, 2024

@supergyz 没有,我只是跑的我自己的数据集…

from bert-classification-tutorial.

RebeccaRrr avatar RebeccaRrr commented on June 22, 2024

@hxs91 这个10分类的数据集跑了吗;我觉着上面谁跑到0.8的都是自己的数据集,不是这个1000行10分类数据集的结果。。。

我跑到了,不知道跑的对不对,但肯定没有用自己的数据集。
命令是
python3 run_classifier.py --data_dir=./data --vocab_file=./uncased_L-12_H-768_A-12/vocab.txt --bert_config_file=./uncased_L-12_H-768_A-12/bert_config.json --init_checkpoint=./uncased_L-12_H-768_A-12/bert_model.ckpt --output_dir=./output

可以请问一下你是怎么处理的呢?只是删除了第一行shuffle了数据吗?
方便的话可以发一下你的shuffle代码吗?谢谢!!

from bert-classification-tutorial.

hxs91 avatar hxs91 commented on June 22, 2024

@RebeccaRrr _create_examples中在return之前random.shuffle(examples)

from bert-classification-tutorial.

JepsonWong avatar JepsonWong commented on June 22, 2024

@hxs91 这个10分类的数据集跑了吗;我觉着上面谁跑到0.8的都是自己的数据集,不是这个1000行10分类数据集的结果。。。

我跑到了,不知道跑的对不对,但肯定没有用自己的数据集。
命令是
python3 run_classifier.py --data_dir=./data --vocab_file=./uncased_L-12_H-768_A-12/vocab.txt --bert_config_file=./uncased_L-12_H-768_A-12/bert_config.json --init_checkpoint=./uncased_L-12_H-768_A-12/bert_model.ckpt --output_dir=./output

可以请问一下你是怎么处理的呢?只是删除了第一行shuffle了数据吗?
方便的话可以发一下你的shuffle代码吗?谢谢!!

_create_examples函数返回数据之前random.shuffle(examples)。没有删除第一行呀,原代码中删了吧,我看作者循环中在读取的时候if i==0 已经进行continue操作了。

from bert-classification-tutorial.

supergyz avatar supergyz commented on June 22, 2024

@JepsonWong 我也跑到啦~

from bert-classification-tutorial.

LightingFx avatar LightingFx commented on June 22, 2024

@hxs91 的确需要做shuffle,我之前以为代码中是有做shuffle的…在processor的_create_esamples中对examples做一下shuffle即可。我的实验(200+个类别文本分类)上结果从14%提升到91.7%

你好,请问下你200+类别的数据集有多大?用到多少个句子,我现在想做个大概90个类别的任务,想评估下自己的数据集大概有多少就够了。

from bert-classification-tutorial.

mofengboy avatar mofengboy commented on June 22, 2024

我问一下num_train_epochs=100.0的情况下,checkpoints的数量大概有多少?我跑了好长时间了还没跑完。

from bert-classification-tutorial.

supergyz avatar supergyz commented on June 22, 2024

from bert-classification-tutorial.

Duanexiao avatar Duanexiao commented on June 22, 2024

@jotline 两个原因。你看下data下的数据,第一行其实是噪音建议删去,稍微修改下_create_examples函数。因为如果先shuffle的话,第一行会被当成训练数据进去,更糟糕的是会多了个label变成11分类。第二个就加大步长,原文中写的是3000多步,也就是100epochs;我跑到1000步最高达到0.71,之后就没试过了。

请问是每个_create_examples都需要加random.shuffle(examples)吗?

from bert-classification-tutorial.

Duanexiao avatar Duanexiao commented on June 22, 2024

image

from bert-classification-tutorial.

NancyLele avatar NancyLele commented on June 22, 2024

@jotline
我有个问题,对于测试集一定要赋标签吗。
若不给test加标签,file_based_convert_examples_to_features就会报错,提示label是none。
若加了一个常量标签(即所有测试数据固定一个标签),那么预测结果就变成了之前设定好的标签。
这个问题,要怎么解决呢?

from bert-classification-tutorial.

ann22 avatar ann22 commented on June 22, 2024

我用您的代码跑了一下数据,eval accuracy 只有0.1,predict 的结果并没有图片中的80%那么高?

没有shuffle数据的原因 @yun97 @hxs91

您好,为什么要将数据打乱

from bert-classification-tutorial.

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.