---
license: mit
---
ghostmax/softmax1 trained on tinystories for 500M tokens.
ckpt will be out_* files trained 2 models 1 with regular softmax
REPO: https://github.com/joey00072/llama2.c/tree/ghostmax
softmax: https://wandb.ai/shubhamchoudhari00072/ghostmax/reports/loss-val-23-08-25-21-48-58---Vmlldzo1MjM0MjUw
ghostmax: https://wandb.ai/shubhamchoudhari00072/ghostmax/reports/loss-val-23-08-25-21-50-15---Vmlldzo1MjM0MjYw
```python
def softmax(x, dim=None):
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim=True)[0])
return e_x / e_x.sum(dim=dim, keepdim=True)
def ghostmax(x, dim=None):
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim=True)[0])
return e_x / (1+e_x.sum(dim=dim, keepdim=True) )
```