Instructions to use awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M
- SGLang
How to use awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M with Docker Model Runner:
docker model run hf.co/awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M
DAT-sa8-ra8-ns1024-sh8-nkvh4-343M
This is a Dual-Attention Transformer Language Model, trained on the fineweb-edu dataset. The model is 343M parameters.
Model Details
| Size | Training Tokens | Layers | Model Dimension | Self-Attention Heads | Relational Attention Heads | Relation Dimension | Context Length |
|---|---|---|---|---|---|---|---|
| 343M | 10B | 24 | 1024 | 8 | 8 | 8 | 1024 |
Model Description
- Developed by: Awni Altabaa, John Lafferty
- Model type: Decoder-only Dual Attention Transformer
- Tokenizer: GPT-2 BPE tokenizer
- Language(s): English
- Date: August, 2024
Model Sources
- Repository: https://github.com/Awni00/abstract_transformer
- Paper: Disentangling and Integrating Relational and Sensory Information in Transformer Architectures
- Huggingface Collection: Dual Attention Transformer Collection
Model Usage
Use the code below to get started with the model. First, install the dual-attention python package hosted on PyPI via pip install dual-attention.
To load directly from huggingface hub, use the HFHub wrapper.
from dual_attention.hf import DualAttnTransformerLM_HFHub
DualAttnTransformerLM_HFHub.from_pretrained('awni00/DAT-sa8-ra8-ns1024-sh8-nkvh4-343M')
Training Details
The model was trained using the following setup:
- Architecture: Decoder-only Dual Attention Transformer
- Framework: PyTorch
- Optimizer: AdamW
- Learning Rate: 6e-4 (peak)
- Weight Decay: 0.1
- Batch Size: 524,288 Tokens
- Sequence Length: 1024 tokens
- Total Training Tokens: 10B Tokens
For more detailed training information, please refer to the paper.
Evaluation
See paper.
Model Interpretability Analysis
The DAT-LM-Visualization app is built to visualize the representations learned in a Dual Attention Transformer language model. It is hosted on Huggingface spaces using their free CPU resources. You can select a pre-trained DAT-LM model, enter a prompt, and visualize the internal representations in different parts of the model. You can also run the app locally (e.g., to use your own GPU) via the PyPI package.
Also, see paper.
Citation
@misc{altabaa2024disentanglingintegratingrelationalsensory,
title={Disentangling and Integrating Relational and Sensory Information in Transformer Architectures},
author={Awni Altabaa and John Lafferty},
year={2024},
eprint={2405.16727},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2405.16727},
}
- Downloads last month
- 14