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

ABOut the code #1

Closed
sanwei111 opened this issue Jun 18, 2021 · 3 comments
Closed

ABOut the code #1

sanwei111 opened this issue Jun 18, 2021 · 3 comments

Comments

@sanwei111
Copy link

我想问问有没有原始transformer求flop的代码

@XingLuxi
Copy link
Owner

原始Transformer是指在用于NMT任务的Transformer吗?

@sanwei111
Copy link
Author

原始Transformer是指在用于NMT任务的Transformer吗?

嗯呢,有几个问题:
1.你的例子中是基于bert的,有一些参数,变量不太看得懂,比如from transformers import BertForSequenceClassification, BertTokenizer from transformers import RobertaForSequenceClassification, RobertaTokenizer
2.这个算法是在训练数据集,还是测试数据
3.模型的长度是自己给一个定长,还是实打实的算句子实际的长度

@XingLuxi
Copy link
Owner

1、BertForSequenceClassification、BertTokenizer、RobertaForSequenceClassification、RobertaTokenizer是import自huggingface-transformer,分别是用于句子分类的BERT模型、BERT分词器、用于句子分类的RoBERTa模型、RoBERTa分词器,具体代码,请参见 https://github.com/huggingface/transformers/tree/v2.5.1 ,本repo测试的transformer版本是2.5.1;
2、这个算法是在测试模型在计算过程中FLOPs,是与模型结构相关的性能,和使用数据集或者单条数据无关;
3、example.py中的长度是设置的一个最大长度,超过最大长度的部分会被Tokenizer截去,可以根据输入的情况进行更改。

@XingLuxi XingLuxi closed this as completed Feb 9, 2023
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

2 participants