Downloads · 30 days
17
0% of all-time downloads
naxalpha/gated-state-space
gated-state-space is a text generation model from naxalpha. Use it when you need the model to write or continue text. It is set up for lucidrains/gated-state-spaces-pytorch. The card lists the license as mit.
This repo contains pretrain model for the gated state space paper. The model has been trained on C4 dataset. I have used Lucidrains' implementation (commit) for the model. I think the main benefit of this model is the…
Downloads · 30 days
17
0% of all-time downloads
All-time downloads
9.7K
Public
Repo size
11.3 GB
Likes
0
Public
Click a slice to open those files.
.pt5.7 GB · 100%
From the Hugging Face model README
This repo contains pretrain model for the gated state space paper. The model has been trained on C4 dataset. I have used Lucidrains' implementation (commit) for the model. I think the main benefit of this model is the ability to scale beyond the training context length. As authors noted in the paper, they trained the model on 4k sequence length but it generalized beyond that length. I have written a blog post on how I started the training here.
Wandb Report is available at this link
Since it is not based on transformers library, it is a bit tricky to use the model out of the box. Here are the general steps:
pip install gated-state-spaces-pytorch model = AutoregressiveWrapper(
GatedStateSpacesLM(
**config
),
)
model.net.to_logits = nn.Sequential(
nn.LayerNorm(f_emb),
model.net.to_logits,
)
model.load_state_dict(torch.load('model.pt')) model.net.token_emb.weight.requires_grad_(False)
model.net.token_emb.weight.copy_(emb)
model.net.to_logits[1].weight.requires_grad_(False)
model.net.to_logits[1].weight.copy_(emb)
Training code is available in this repo. Link to the training script.
Here are the details of the training:
Alternate between simple cross entropy and GPT-2 XL distillation481282e-5AdamW1.0RTX 3090 on vast.ai~20$~3 days557,000570 million~3.9model2.pt is available as fine-tuned version with longer context length.
Simple Cross Entropy4120485e-6unfrozen for fine-tuning1.02x3090 on vast.aiUsed HuggingFace Accelerate with Full Sharding without CPU offload