Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dc committed Sep 28, 2023
1 parent ebd3abc commit e394e4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# Mistral Transformer

This repository contains minimal code to run our 7B model.
[Discord](https://discord.com/invite/mistralai)
This repository contains minimal code to run our 7B model.\
Blog: [https://mistral.ai/news/announcing-mistral-7b/](https://mistral.ai/news/announcing-mistral-7b/)\
Discord: [https://discord.com/invite/mistralai](https://discord.com/invite/mistralai)

## Installation

```
pip install -r requirements.txt
```

## Download the model
```
wget https://files.mistral-7b-v0-1.mistral.ai/mistral-7B-v0.1.tar
tar -xf mistral-7B-v0.1.tar
```

## Run the model

```
python -m main demo /path/to/model
python -m main demo /path/to/mistral-7B-v0.1/
# To give your own prompts
python -m main interactive /path/to/model
python -m main interactive /path/to/mistral-7B-v0.1/
```
Change `temperature` or `max_tokens` using:
```
python -m main interactive /path/to/mistral-7B-v0.1/ --max_tokens 256 --temperature 1.0
```

If you want a self-contained implementation, look at `one_file_ref.py`, or run it with
```
python -m one_file_ref /path/to/model
python -m one_file_ref /path/to/mistral-7B-v0.1/
This is a test of the emergency broadcast system. This is only a test.
Expand Down Expand Up @@ -88,6 +99,10 @@ For this we can choose as chunk size the window size. For each chunk, we thus ne
![Chunking](assets/chunking.png)


## More Links

[Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) and [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1) are also available on HuggingFace.

## References

[1] [Generating Long Sequences with Sparse Transformers, Child et al. 2019](https://arxiv.org/pdf/1904.10509.pdf)
Expand Down
2 changes: 2 additions & 0 deletions test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def test_generation():
for lp_old, lp_new in zip(all_logprobs_old, all_logprobs_new):
assert all([abs(x - y) < 1e-5 for x, y in zip(lp_old, lp_new)]), f"\n{lp_old}\n{lp_new}"

print("All tests passed.")


def test_chunks():
torch.manual_seed(42)
Expand Down

0 comments on commit e394e4e

Please sign in to comment.