yujun
yujun
我发现给的伪代码中这个`rel_pos_bias`好像也有点问题,下面这个是原始的实现方式。 ```python import torch max_position_embeddings = 512 w = torch.arange(2 * max_position_embeddings - 1).float() print(w.long()) def rel_pos_bias(seq_len, w): # Construct Toeplitz matrix directly when the sequence length is less than...
感觉影响应该不大吧,先`mask`掉就qk的部分值成了0,对0进行relu,square操作还是0,主要区别是多加了`bias`部分。 还有我mask的时候把矩阵padding位置的行和列都进行mask了。 还有正常来说mask一般不是都施加给attetnion注意力得分的吗? 我现在正在使用 https://github.com/lucidrains/FLASH-pytorch 的代码训练small的模型。 也差不多快训练完了,你之后可以试试 https://wandb.ai/junyu/huggingface/runs/1jg2jlgt?workspace=user-junyu
我先上传个19W步数的给你试试
```python import torch from flash_pytorch import FLASHTransformer from transformers import BertTokenizerFast model = FLASHTransformer( num_tokens=12000, # number of tokens dim=768, # model dimension depth=12, # depth causal=False, # autoregressive or...
权重 https://wss1.cn/f/7z0orce18tp 复制链接到浏览器打开
- small版本 + 25W训练步数 + batch_size 128 + lr 1e-4 + 线性衰减学习率 + max_length 512 - 最终训练集MLM准确率51%左右 - 权重现已添加:https://huggingface.co/junnyu/flash_small_wwm_cluecorpussmall - 完整训练日志:https://wandb.ai/junyu/huggingface/runs/1jg2jlgt
新权重`padding`到最大长度512的可能效果会好一点把。不知道你实验的适合有没有padding到最大长度。 > * 最终训练集MLM准确率51%左右 > * 权重现已添加:https://huggingface.co/junnyu/flash_small_wwm_cluecorpussmall > * 完整训练日志:https://wandb.ai/junyu/huggingface/runs/1jg2jlgt
tokenizer(text, return_tensors="pt", max_length=512, padding="max_length")
我测试这新的代码的时候,发现短的文本不padding到512,预测结果不大理想
https://github.com/JunnYu/GPLinker_pytorch/blob/a067a086664944b5c334c05ba719a248ab1687d1/models.py#L304-L312 当前的实验结果都是使用的`GlobalPointer`, 要想使用`Efficient GlobalPointer`,可以在命令行使用`--use_efficient`。 ```bash accelerate launch train.py \ --model_type bert \ --pretrained_model_name_or_path bert-base-chinese \ --method gplinker \ --logging_steps 200 \ --num_train_epochs 20 \ --learning_rate 3e-5 \ --num_warmup_steps_or_radios 0.1 \...