Skip to content

Commit

Permalink
Add Dockerfile and convert script for llama31
Browse files Browse the repository at this point in the history
  • Loading branch information
ljvmiranda921 committed Jan 8, 2025
1 parent aea92b9 commit ce3f146
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
3 changes: 2 additions & 1 deletion evals/convert.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ ENV PATH="/usr/local/google-cloud-sdk/bin:${PATH}"

# Clone EasyLM repository
RUN git clone https://github.com/hamishivi/EasyLM.git . && \
git checkout bc241782b67bbe926e148ec9d2046d76b7ba58c8
# git checkout bc241782b67bbe926e148ec9d2046d76b7ba58c8
git checkout dbf2212c1775b2762f7108d62c8c8b01b52ea4aa

COPY ai2-allennlp-79f5e3a8e95a.json /root/.config/gcloud/application_default_credentials.json
# Set environment variable for Google Cloud
Expand Down
7 changes: 6 additions & 1 deletion evals/convert_to_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ def main():
)
pytorch_dir = Path(args.pytorch_dir)
for params_path in params_paths:
experiment_name = params_path.parent.stem.split("--")[0]
if "llama" in str(params_path):
experiment_name = (
str(params_path.parent).split("--")[0].replace(".", "-")
)
else:
experiment_name = params_path.parent.stem.split("--")[0]
if args.prefix:
experiment_name = f"{args.prefix}-{experiment_name}"
output_dir = pytorch_dir / experiment_name
Expand Down
39 changes: 39 additions & 0 deletions evals/templates/template-llama31.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: v2
budget: ai2/oe-adapt
description: "Convert model to pytorch and launch a rewardbench eval job"
tasks:
- name: template
image:
beaker: ljm/easylm-convert-llama
command: ["python", "convert_to_hf.py"]
arguments:
- --gcs_bucket
- ljm-dev
- --batch_size
- 1
- --tokenizer_path
- meta-llama/Llama-3.1-8B
- --model_size
- 8b31
result:
path: /output
resources:
gpuCount: 1
context:
priority: normal
preemptible: true
constraints:
cluster:
- ai2/allennlp-cirrascale
- ai2/jupiter-cirrascale-2
envVars:
- name: OPENAI_API_KEY
secret: OPENAI_API_KEY
- name: GOOGLE_SERVICE_ACCOUNT
secret: GOOGLE_SERVICE_ACCOUNT
- name: BEAKER_TOKEN
secret: BEAKER_TOKEN
- name: TOKENIZERS_PARALLELISM
value: "false"
- name: HF_TOKEN
secret: HF_TOKEN

0 comments on commit ce3f146

Please sign in to comment.