license:mit region:us
---
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 <br>
ghostmax: https://wandb.ai/shubhamchoudhari00072/ghostmax/reports/loss-val-23-08-25-21-50-15---Vmlldzo1MjM0MjYw <br>
<br>

```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) )

```
<br>
<iframe src="https://wandb.ai/shubhamchoudhari00072/ghostmax/runs/cbeei9uh?workspace=user-shubhamchoudhari00072" style="border:none;height:1024px;width:100%">
<br>

