Skip to content

Commit

Permalink
⚗️ Style Transfer: add experiments for azure and jean-zay, bump trans…
Browse files Browse the repository at this point in the history
…formers version to use llama3.2
  • Loading branch information
simonmeoni committed Oct 8, 2024
1 parent 0def121 commit fd52203
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lib/style-transfer/bash/experiment/rb_gen/az/llama3.2-3b.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python style_transfer/run_rb_gen.py model.name=meta-llama/Llama-3.2-3B-Instruct \
model.peft_config.target_modules='["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]' \
dataset.name=bio-datasets/mimic_style_transfer \
max_steps=3 \
score.model.model_name_or_path=FremyCompany/BioLORD-2023-C \
dataset.sft_ratio=0.06 \
dataset.gen_ratio=0.7
1 change: 1 addition & 0 deletions lib/style-transfer/bash/experiment/rb_gen/az/test-azure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python style_transfer/run_rb_gen.py
6 changes: 6 additions & 0 deletions lib/style-transfer/bash/experiment/rb_gen/jz-slurm/llama3b.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sbatch bash/jz-slurm/submit-a100.sh \
model.name=meta-llama/Llama-3.2-3B-Instruct \
model.lora.target_modules='["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]' \
dataset.name=bio-datasets/mimic_style_transfer \
max_steps=3 \
score.model_name_or_path=FremyCompany/BioLORD-2023-C
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#SBATCH --cpus-per-task=10
#SBATCH --output=log/conversion%j.out
#SBATCH --partition=prepost
#SBATCH --account=oha@cpu
#SBATCH --account=oha@v100

module purge
module load singularity
Expand Down
21 changes: 21 additions & 0 deletions lib/style-transfer/bash/experiment/rb_gen/jz-slurm/submit-a100.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#SBATCH --job-name=gpu-job
#SBATCH --nodes=1
#SBATCH --gres=gpu:1
#SBATCH --cpus-per-task=10
#SBATCH --output=log/test.out
#SBATCH --partition=gpu_p5
#SBATCH --account=oha@a100
#SBATCH -C a100
#SBATCH --qos=qos_gpu_a100-t3

module purge
module load singularity

SCRIPT_PATH="style_transfer/run_rb_gen.py"
PYTHON="/opt/pysetup/.venv/bin/python"
LIB_PATH="$WORK/open-nlp/lib/style-transfer/"
singularity exec --bind $WORK/open-nlp,$HF_HOME,$WANDB_CACHE_DIR,$WANDB_DIR \
--env PYTHONPATH=$PYTHONPATH:$LIB_PATH,HF_HUB_OFFLINE=True \
--nv $SINGULARITY_ALLOWED_DIR/style-transfer.sif \
bash -c "cd $LIB_PATH && $PYTHON $SCRIPT_PATH $1"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#SBATCH --partition=gpu_p5
#SBATCH --account=oha@a100
#SBATCH -C a100
#SBATCH --qos=qos_gpu-dev
#SBATCH --qos=qos_gpu_a100-dev

module purge
module load singularity
Expand Down
1 change: 0 additions & 1 deletion lib/style-transfer/bash/experiment/rb_gen/test-azure.sh

This file was deleted.

2 changes: 1 addition & 1 deletion lib/style-transfer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ rich = "^13.5.2"
sentence-transformers = "^2.3.1"
torch = "^2.3.0"
tqdm = "^4.66.1"
transformers = "4.42.3"
transformers = "4.45.1"
trl = "^0.9.6"
vllm = "^0.5.0.post1"
wandb = "^0.16.3"
Expand Down
4 changes: 2 additions & 2 deletions lib/style-transfer/style_transfer/rb_gen/steps/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def generate(
tokenizer.save_pretrained("models/merged/")
del model
del tokenizer
gc.collect()
torch.cuda.empty_cache()
#gc.collect()
#torch.cuda.empty_cache()
logging.info("🫧 Building VLLM Pipeline ...")
llm = LLM(
model="models/merged/",
Expand Down

0 comments on commit fd52203

Please sign in to comment.