From f7bfd4ca9e7da34e4a670f09319c22102cfefee9 Mon Sep 17 00:00:00 2001 From: Charles Frye Date: Thu, 8 Aug 2024 13:52:53 -0400 Subject: [PATCH] fix small nits (#76) * remove deprecated background commit flag * move yaml import out of global scope * rename huggingface secret to default --- README.md | 2 +- src/common.py | 2 +- src/inference.py | 2 +- src/train.py | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e8e110fa..e6897ff4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Inference on the fine-tuned model displays conformity to the output structure (` 1. Create a [Modal](https://modal.com/) account. 2. Install `modal` in your current Python virtual environment (`pip install modal`) 3. Set up a Modal token in your environment (`python3 -m modal setup`) - 4. You need to have a [secret](https://modal.com/docs/guide/secrets#secrets) named `huggingface` in your workspace. You can [create a new secret](https://modal.com/secrets) with the HuggingFace template in your Modal dashboard, using the key from HuggingFace (in settings under API tokens) to populate `HF_TOKEN` and changing the name from `my-huggingface-secret` to `huggingface`. + 4. You need to have a [secret](https://modal.com/docs/guide/secrets#secrets) named `my-huggingface-secret` in your workspace. You can [create a new secret](https://modal.com/secrets) with the HuggingFace template in your Modal dashboard, using the key from HuggingFace (in settings under API tokens) to populate `HF_TOKEN`. 5. For some LLaMA models, you need to go to the Hugging Face page (e.g. [this page for LLaMA 3 8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B)\_ and agree to their Terms and Conditions for access (granted instantly). 6. If you want to use [Weights & Biases](https://wandb.ai) for logging, you need to have a secret named `wandb` in your workspace as well. You can also create it [from a template](https://modal.com/secrets). Training is hard enough without good logs, so we recommend you try it or look into `axolotl`'s integration with [MLFlow](https://mlflow.org/)! diff --git a/src/common.py b/src/common.py index 71abb02a..d535c367 100644 --- a/src/common.py +++ b/src/common.py @@ -45,7 +45,7 @@ app = modal.App( APP_NAME, secrets=[ - modal.Secret.from_name("huggingface"), + modal.Secret.from_name("my-huggingface-secret"), modal.Secret.from_dict({"ALLOW_WANDB": os.environ.get("ALLOW_WANDB", "false")}), *([modal.Secret.from_name("wandb")] if ALLOW_WANDB else []), ], diff --git a/src/inference.py b/src/inference.py index 700a59ac..6e2aa0a0 100644 --- a/src/inference.py +++ b/src/inference.py @@ -1,6 +1,5 @@ import os import time -import yaml from pathlib import Path import modal @@ -21,6 +20,7 @@ from vllm.engine.async_llm_engine import AsyncLLMEngine from vllm.sampling_params import SamplingParams from vllm.utils import random_uuid + import yaml def get_model_path_from_run(path: Path) -> Path: diff --git a/src/train.py b/src/train.py index 3aa412b8..40fec5b3 100644 --- a/src/train.py +++ b/src/train.py @@ -23,7 +23,6 @@ gpu=GPU_CONFIG, volumes=VOLUME_CONFIG, timeout=24 * HOURS, - _allow_background_volume_commits=True, ) def train(run_folder: str, output_dir: str): import torch @@ -48,7 +47,6 @@ def train(run_folder: str, output_dir: str): gpu=SINGLE_GPU_CONFIG, volumes=VOLUME_CONFIG, timeout=24 * HOURS, - _allow_background_volume_commits=True, ) def preproc_data(run_folder: str): print("Preprocessing data.")