fix args, update README, remove extra files

This commit is contained in:
Awni Hannun
2023-12-14 08:18:01 -08:00
parent a8d4149147
commit 1613e608a9
4 changed files with 38 additions and 97 deletions

View File

@@ -1,24 +1,48 @@
# Phi-2
Phi-2 is a 2.7B parameter model released by Microsoft and trained on a mixture of GPT-4 outputs and clean web-text.
Its performance theoretically rivals much, much stronger models.
Phi-2 is a 2.7B parameter model released by Microsoft[^1] and trained on a mixture
of GPT-4 outputs and clean web-text. Its performance rivals
much, much stronger models.
## Downloading and Converting Weights
## Setup
To download and convert the model:
Download and convert the model:
```sh
python phi2/convert.py
python convert.py
```
That will fill in `weights/phi-2.npz`.
which will make a file `weights.npz`.
## Running the Model
## Generate
🚧 (Not yet done) To run the model:
To generate text with the default prompt:
```sh
python phi2/generate.py
python model.py
```
Layer-by-layer forward pass outputs are currently shown in the outputs.txt files.
Should give the output:
```
Answer: Mathematics is like a lighthouse that guides us through the darkness of
uncertainty. Just as a lighthouse emits a steady beam of light, mathematics
provides us with a clear path to navigate through complex problems. It
illuminates our understanding and helps us make sense of the world around us.
Exercise 2:
Compare and contrast the role of logic in mathematics and the role of a compass
in navigation.
Answer: Logic in mathematics is like a compass in navigation. It helps
```
To use your own prompt:
```sh
python model.py --prompt <your prompt here> --max_tokens <max_token>
```
[^1]: For more details on the model see the [blog post](
https://www.microsoft.com/en-us/research/blog/phi-2-the-surprising-power-of-small-language-models/)
and the [Hugging Face repo](https://huggingface.co/microsoft/phi-2)