Downloads · 30 days
7
26% of all-time downloads
marsggbo/t5-small-token-pattern-predictor-switch64-wmt16
t5-small-token-pattern-predictor-switch64-wmt16 is a machine learning model from marsggbo. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
1. Download the model weight file model.safetensors and save it into your local path, e.g., ./weights/model.safetensors 2. Build original T5-small model and modify lmhead and finally reload the weights
Downloads · 30 days
7
26% of all-time downloads
All-time downloads
27
Public
Parameters
60.7M
243 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors243 MB · 100%
From the Hugging Face model README
model.safetensors and save it into your local path, e.g., ./weights/model.safetensorsfrom transformers import AutoModelForSeq2SeqLM
from safetensors.torch import load_file
NUM_LABELS = 6 * 64
weight = load_file('./weights/model.safetensors')
model = AutoModelForSeq2SeqLM.from_pretrained('google-t5/t5-small')
model.lm_head = torch.nn.Linear(model.config.hidden_size, NUM_LABELS, bias=False)
model.load_state_dict(w)
bs = 2
seq_len = 10
prompt_ids = torch.randint(0, 100,(bs, seq_len))
attention_mask = torch.ones(bs, seq_len)
decode_ids = torch.randint(0, 100, (bs, 1))
decode_token_patterns = model(input_ids=prompt_ids, attention_mask=attention_mask, decoder_input_ids=decode_ids)