-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📚 docs: LLM doc & split tests (#129)
- Loading branch information
1 parent
6a188fd
commit c3a8ade
Showing
13 changed files
with
594 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 🚀 NLP Example | ||
|
||
This is the documentation for running | ||
[LLMs](../../Tests/GrAIExamples/NLPExample.swift) on the GPU. | ||
|
||
## Setup | ||
|
||
This example has some `Python` dependencies. In order to run | ||
the example, we first have to setup the environment: | ||
|
||
```bash | ||
conda create --name graiexamples python=3.9 | ||
conda activate graiexamples | ||
cd Tests/GrAIExamples/Base | ||
pip install -e . | ||
``` | ||
|
||
Then: | ||
- download weights from | ||
[MistralAI](https://docs.mistral.ai/getting-started/open_weight_models/). | ||
- Update `_modelPath` in the | ||
[NLPExample](../../Tests/GrAIExamples/NLPExample.swift) file with the | ||
previous downloaded weights. | ||
- Optionnally update `_prompt`. | ||
- Rename `_testGenerate` into `testGenerate`. | ||
- Run the test. | ||
|
||
It is finally possible to clean the environment 🌍 | ||
|
||
```bash | ||
conda deactivate | ||
conda env remove --name graiexamples | ||
``` | ||
|
||
## Steps | ||
|
||
1. Generate text from a prompt. | ||
|
||
## Further tests | ||
|
||
Further tests are available at | ||
[NLPExampleTests](../../Tests/GrAIExamples/NLPExampleTests.swift). | ||
In order to run them, rename | ||
`_testPredict1` and `_testPredict32` into `testPredict1` and `testPredict32`. | ||
|
||
The test `testPredict1` compares the first step of generation | ||
of a toy LLM (just one transformer block) in GrAIdient and in PyTorch. | ||
|
||
The test `testPredict32` runs the first step of generation | ||
of a full LLM in GrAIdient and compares the expected result from PyTorch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.