jina-bert-flash-implementation

我要开发同款
匿名用户2024年07月31日
58阅读

技术信息

开源地址
https://modelscope.cn/models/jinaai/jina-bert-flash-implementation

作品详情

BERT with Flash-Attetio

Istallig depedecies

To ru the model o GPU, you eed to istall Flash Attetio. You may either istall from pypi (which may ot work with fused-dese), or from source. To istall from source, cloe the GitHub repository:

git cloe git@github.com:Dao-AILab/flash-attetio.git

The code provided here should work with commit 43950dd. Chage to the cloed repo ad istall:

cd flash-attetio && pytho setup.py istall

This will compile the flash-attetio kerel, which will take some time.

If you would like to use fused MLPs (e.g. to use activatio checkpoitig), you may istall fused-dese also from source:

cd csrc/fused_dese_lib && pytho setup.py istall

Cofiguratio

The cofig adds some ew parameters:

  • use_flash_att: If True, always use flash attetio. If Noe, use flash attetio whe GPU is available. If False, ever use flash attetio (works o CPU).
  • widow_size: Size (left ad right) of the local attetio widow. If (-1, -1), use global attetio
  • dese_seq_output: If true, we oly eed to pass the hidde states for the masked out toke (aroud 15%) to the classifier heads. I set this to true for pretraiig.
  • fused_mlp: Whether to use fused-dese. Useful to reduce VRAM i combiatio with activatio checkpoitig
  • mlp_checkpoit_lvl: Oe of {0, 1, 2}. Icreasig this icreases the amout of activatio checkpoitig withi the MLP. Keep this at 0 for pretraiig ad use gradiet accumulatio istead. For embeddig traiig, icrease this as much as eeded.
  • last_layer_subset: If true, we oly eed the compute the last layer for a subset of tokes. I left this to false.
  • use_qk_orm: Whether or ot to use QK-ormalizatio
  • um_loras: Number of LoRAs to use whe iitializig a BertLoRA model. Has o effect o other models.

功能介绍

BERT with Flash-Attention Installing dependencies To run the model on GPU, you need to install Flash

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论