Skip to content

Commit

Permalink
fix: update docs and scripts for the Llama2 experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyli committed Feb 16, 2024
1 parent 860db14 commit bdbb913
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/Llama2FineTuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ cd Llama-2-7b-hf
git lfs fetch
```

6. Copy the content of [`requirements.txt`](https://github.com/facebookresearch/llama/blob/main/requirements.txt)
for setting up the Llama2 models into a new file named `requirements-llama2.txt` in the "llama" directory.

## Use the Llama2 model

In the [`jobs/original_use`](../jobs/Llama2/original_use) directory, there are two scripts:
Expand Down
17 changes: 13 additions & 4 deletions jobs/Llama2/original_use/job_original_use_7b_hf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@
#SBATCH --cpus-per-task=4
#SBATCH --account=def-whkchun
#SBATCH --output=%x.o%j
pip install --no-index --upgrade pip
module load python/3.8.2

pip install --upgrade pip
module load python/3.11.5
python -V

source ~/llama2/.venv/bin/activate
virtualenv --no-download $SLURM_TMPDIR/env
source $SLURM_TMPDIR/.env/bin/activate

pip install --upgrade pip

module load StdEnv/2023
module load rust/1.70.0
pip install --no-index transformers==4.36.2
pip install -r /home/cindyli/llama2/requirements-llama2.txt

python -V
pip list

echo "Llama2 original use from job $SLURM_JOB_ID on nodes $SLURM_JOB_NODELIST."
Expand Down
2 changes: 1 addition & 1 deletion jobs/Llama2/original_use/original_use_7b_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# write results into the result file
file.write("2. Word prediction: \n")
for prediction in predictions:
file.write(f"- {prediction['generated_text']}: {prediction['score']}\n")
file.write(f"- {prediction['generated_text']}\n")
file.write("\n")

# 3. Test prompt for inference
Expand Down
4 changes: 4 additions & 0 deletions jobs/Llama2/requirements-llama2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
torch
fairscale
fire
sentencepiece

0 comments on commit bdbb913

Please sign in to comment.