Skip to content

Commit 631e66f

Browse files
committed
cpu installation
1 parent f1ce1ea commit 631e66f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/cpu-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
4141
- name: Run tests without the package installed
4242
run: |
43+
# install torch cpu nightly
44+
python -c "with open('requirements.txt', 'r+') as fp: c = fp.read().replace('cu118', 'cpu'); fp.seek(0); fp.write(c); fp.truncate()"
45+
4346
pip install pytest -r requirements.txt 'transformers==4.27.3'
4447
pip list
4548

lit_stablelm/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
146146
k = torch.cat((k_roped, k[..., n_elem:]), dim=-1)
147147

148148
# efficient attention using Flash Attention CUDA kernels
149-
y = F.scaled_dot_product_attention(q, k, v.float(), attn_mask=None, dropout_p=0.0, is_causal=True, scale=1.0 / math.sqrt(head_size))
149+
y = F.scaled_dot_product_attention(
150+
q, k, v, attn_mask=None, dropout_p=0.0, is_causal=True, scale=1.0 / math.sqrt(head_size)
151+
)
150152

151153
y = y.transpose(1, 2).contiguous().view(B, T, C) # re-assemble all head outputs side by side
152154

0 commit comments

Comments
 (0)