Skip to content

Commit

Permalink
Add logo
Browse files Browse the repository at this point in the history
  • Loading branch information
pomonam committed Mar 12, 2024
1 parent 74f624d commit a5152e5
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Kronfluence
<p align="center">
<br>
<img src=".assets/kronfluence.png" width="400"/>
<br>
<p>

[![CI](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/CI.yml/badge.svg)](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/CI.yml)
[![Lint](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/linting.yml/badge.svg)](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/linting.yml)
Expand Down Expand Up @@ -37,6 +41,42 @@ pip install -e .

## Getting Started


```diff
import torch
import torch.nn.functional as F
from datasets import load_dataset
+ from accelerate import Accelerator

+ accelerator = Accelerator()
- device = 'cpu'
+ device = accelerator.device

model = torch.nn.Transformer().to(device)
optimizer = torch.optim.Adam(model.parameters())

dataset = load_dataset('my_dataset')
data = torch.utils.data.DataLoader(dataset, shuffle=True)

+ model, optimizer, data = accelerator.prepare(model, optimizer, data)

model.train()
for epoch in range(10):
for source, targets in data:
source = source.to(device)
targets = targets.to(device)

optimizer.zero_grad()

output = model(source)
loss = F.cross_entropy(output, targets)

- loss.backward()
+ accelerator.backward(loss)

optimizer.step()
```

(Placeholder for getting started content)

## Examples
Expand Down

0 comments on commit a5152e5

Please sign in to comment.