Skip to content

Commit

Permalink
whitespace fixes
Browse files Browse the repository at this point in the history
ghstack-source-id: 5432d9b11af3a2227d31f155e64e548f7142dfde
Pull Request resolved: fairinternal/xformers#1038

__original_commit__ = fairinternal/xformers@8efc885
  • Loading branch information
bottler authored and xFormers Bot committed Feb 26, 2024
1 parent 158f36c commit 9469bb5
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ flake8 --config .flake8
mypy --ignore-missing-imports --scripts-are-modules --pretty --exclude build/ --exclude stubs/ .
```

* or you can just install [pre-commit](https://pre-commit.com/), which will make sure that all of the above is run automatically anytime you commit
in that case, you would need to
* or you can just install [pre-commit](https://pre-commit.com/), which will make sure that all of the above is run automatically anytime you commit
in that case, you would need to
```bash
pip install pre-commit
pip install pre-commit
```
then (in the xformers repository, just once)
```bash
pre-commit install
pre-commit install
```

After these steps each of your commits will run the same linting and formatting routines as the xformers continuous integration, which greatly helps getting your PRs all green !
Expand Down
1 change: 0 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ This is meant to be an easy introduction to using xformers in practice, mirrorin
This is very close to the MicroViT example above, but illustrating the use of a hierarchical Transformer ([Metaformer](https://arxiv.org/pdf/2111.11418.pdf)) this time, through a helper function which generates the required configuration given the pooling parameters. The suggested configuration is about 6.6M parameters big (half of a ResNet18) and trains to about 86% top-1 Cifar10 within minutes.

![Example curves](../docs/assets/metaformer.png)

2 changes: 1 addition & 1 deletion examples/llama_inference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Example runs:
$ python -m generate --ckpt_dir models/CodeLlama-7b-Instruct/
loaded SentencePiece model: #words: 32016 - bos id: 1 - eos id: 2
loaded model in 12.36 seconds
> [INST]abc[/INST]
> [INST]abc[/INST]
I'm not sure I understand what you are saying with "abc". Could you explain?
---------------
> [INST]can you write a hello world program in C#[/INST]
Expand Down
2 changes: 1 addition & 1 deletion xformers/benchmarks/LRA/code/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion xformers/benchmarks/LRA/code/config_nystrom.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion xformers/benchmarks/LRA/code/config_orig_lra.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion xformers/benchmarks/LRA/code/config_orig_lra_paper.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions xformers/ops/fmha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ def memory_efficient_attention(
scale = 1.0 / query.shape[-1] ** 0.5
query = query * scale
query = query.transpose(1, 2)
query = query.transpose(1, 2)
key = key.transpose(1, 2)
value = value.transpose(1, 2)
attn = query @ key.transpose(-2, -1)
if attn_bias is not None:
attn = attn + attn_bias
attn = attn.softmax(-1)
attn = F.dropout(attn, p)
attn = F.dropout(attn, p)
attn = attn @ value
return attn.transpose(1, 2)
Expand Down

0 comments on commit 9469bb5

Please sign in to comment.