英文

ipt-350m

ipt-350m 是一个从头开始训练的解码器风格的Transformer,使用了大约13B个意大利语文本进行预训练。

它采用了经过优化的Transformer架构,以实现高效的训练和推理。位置编码被Attention with Linear Biases替换( ALiBi )。

ipt-350m 具有以下特点:

如果您发现这个项目有用,请考虑支持它的发展:

如何使用

import transformers
model = transformers.AutoModelForCausalLM.from_pretrained(
  'efederici/ipt-350m',
  trust_remote_code=True
)

注意:该模型要求在 from_pretrained 方法中传递 trust_remote_code=True。

要使用 FlashAttention 的优化版 triton implementation ,可以使用 attn_impl='triton' 将模型加载到 GPU( cuda:0 ),并使用 bfloat16 精度:

import torch
import transformers

name = 'efederici/ipt-350m'

config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
config.attn_config['attn_impl'] = 'triton'
config.init_device = 'cuda:0'

model = transformers.AutoModelForCausalLM.from_pretrained(
  name,
  config=config,
  torch_dtype=torch.bfloat16,
  trust_remote_code=True
)

虽然该模型是在序列长度为2048的情况下训练的,但在微调和/或推理过程中,ALiBi可以增加最大序列长度。

import transformers

name = 'efederici/ipt-350m'

config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
config.max_seq_len = 4096 # (input + output) tokens can now be up to 4096

model = transformers.AutoModelForCausalLM.from_pretrained(
  name,
  config=config,
  trust_remote_code=True
)

模型描述

该架构是标准解码器Transformer的修改版。

该模型与标准Transformer的不同之处如下:

Hyperparameter Value
n_parameters 350M
n_layers 24
n_heads 16
d_model 1024
vocab size 50432
sequence length 2048

数据集

该模型在 OSCAR-2301 上对约13B个标记进行了训练(批量大小为64,序列长度为2048)。每个示例由该数据集中所需的序列数量构成,以填充2048的序列长度。

词汇表大小为50432,是128的倍数,根据 MEGATRON-LM 的建议,模型FLOP利用率提高了四个百分点。