Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Pip to Poetry #24

Merged
merged 9 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 22 additions & 34 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,73 +1,61 @@
export WANDB_PROJECT:="ultravox"
export WANDB_LOG_MODEL:="checkpoint"
export PROJECT_DIR:="ultravox"
export VENV_NAME:="venv"
export MCLOUD_CLUSTER:="r7z22"
export MCLOUD_CLUSTER:="r7z22p1"
export MCLOUD_INSTANCE:="oci.bm.gpu.b4.8"

default: format check test

create-venv:
pip install --upgrade virtualenv # older virtualenv had some issues in Debian
python -m venv ${VENV_NAME}
just install

install:
# Install torch 2.2.1 if needed, not present in requirements.txt
just python -c \"import torch\" 2>/dev/null || just pip install torch==2.2.1
just pip install -r requirements.txt
just pip install -r requirements-dev.txt
just python -m pip install types-requests
pip install poetry==1.7.1
poetry install

format:
. ./activate ${VENV_NAME} && autoflake ${PROJECT_DIR} --remove-all-unused-imports --quiet --in-place -r --exclude third_party
. ./activate ${VENV_NAME} && isort ${PROJECT_DIR} --force-single-line-imports
. ./activate ${VENV_NAME} && black ${PROJECT_DIR}
poetry run autoflake ${PROJECT_DIR} --remove-all-unused-imports --quiet --in-place -r --exclude third_party
poetry run isort ${PROJECT_DIR} --force-single-line-imports
poetry run black ${PROJECT_DIR}

check:
. ./activate ${VENV_NAME} && black ${PROJECT_DIR} --check
. ./activate ${VENV_NAME} && isort ${PROJECT_DIR} --check --force-single-line-imports
. ./activate ${VENV_NAME} && autoflake ${PROJECT_DIR} --check --quiet --remove-all-unused-imports -r --exclude third_party
. ./activate ${VENV_NAME} && mypy ${PROJECT_DIR}
poetry run black ${PROJECT_DIR} --check
poetry run isort ${PROJECT_DIR} --check --force-single-line-imports
poetry run autoflake ${PROJECT_DIR} --check --quiet --remove-all-unused-imports -r --exclude third_party
poetry run mypy ${PROJECT_DIR}

test *ARGS=".":
. ./activate ${VENV_NAME} && cd ${PROJECT_DIR} && pytest --ignore third_party {{ARGS}}
cd ${PROJECT_DIR} && poetry run pytest --ignore third_party {{ARGS}}

test-verbose *ARGS=".":
. ./activate ${VENV_NAME} && cd ${PROJECT_DIR} && pytest --ignore third_party {{ARGS}} -vv --log-cli-level=INFO {{ARGS}}
cd ${PROJECT_DIR} && poetry run pytest --ignore third_party {{ARGS}} -vv --log-cli-level=INFO {{ARGS}}

@python *FLAGS:
. ./activate ${VENV_NAME} && python {{FLAGS}}

@pip *FLAGS:
. ./activate ${VENV_NAME} && pip {{FLAGS}}
poetry run python {{FLAGS}}

train *FLAGS:
just python -m ultravox.training.train {{FLAGS}}
poetry run python -m ultravox.training.train {{FLAGS}}

train_asr *FLAGS:
just train --config_path ultravox/training/configs/asr_tinyllama.yaml {{FLAGS}}

browse *FLAGS:
just python -m ultravox.tools.data_tool {{FLAGS}}
poetry run python -m ultravox.tools.data_tool {{FLAGS}}

infer *FLAGS:
just python -m ultravox.tools.infer_tool {{FLAGS}}
poetry run python -m ultravox.tools.infer_tool {{FLAGS}}

eval *FLAGS:
just python -m ultravox.tools.eval_tool {{FLAGS}}
poetry run python -m ultravox.tools.eval_tool {{FLAGS}}

tts *FLAGS:
just python -m ultravox.tools.tts_tool {{FLAGS}}
poetry run python -m ultravox.tools.tts_tool {{FLAGS}}

mds *FLAGS:
just python -m ultravox.tools.mds_tool {{FLAGS}}
poetry run python -m ultravox.tools.mds_tool {{FLAGS}}

gradio *FLAGS:
just python -m ultravox.tools.gradio_demo {{FLAGS}}
poetry run python -m ultravox.tools.gradio_demo {{FLAGS}}

run *FLAGS:
mcli run -f mcloud.yaml --follow {{FLAGS}}
poetry run mcli run -f mcloud.yaml --follow {{FLAGS}}

mcloud *FLAGS:
mcli interactive {{FLAGS}} --cluster ${MCLOUD_CLUSTER} --instance ${MCLOUD_INSTANCE} --name `whoami` --command "bash -c \"$(cat setup.sh)\""
poetry run mcli interactive {{FLAGS}} --cluster ${MCLOUD_CLUSTER} --instance ${MCLOUD_INSTANCE} --name `whoami` --command "bash -c \"$(cat setup.sh)\""
6 changes: 0 additions & 6 deletions activate

This file was deleted.

9 changes: 4 additions & 5 deletions mcloud.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Ultravox POC training configuration

# Ultravox training configuration
name: ultravox
image: mosaicml/composer:latest
compute:
gpus: 8
cluster: r7z22
cluster: r7z22p1
integrations:
- integration_type: git_repo
git_repo: fixie-ai/ultravox
git_branch: $UV_BRANCH
pip_install: -r requirements.txt
pip_install: poetry==1.7.1
command: >-
cd ultravox && torchrun --nproc_per_node=8 -m ultravox.training.train --config_path ultravox/training/configs/$UV_CONFIG
cd ultravox && poetry install --no-dev && poetry run torchrun --nproc_per_node=8 -m ultravox.training.train --config_path ultravox/training/configs/$UV_CONFIG
env_variables:
farzadab marked this conversation as resolved.
Show resolved Hide resolved
MLFLOW_TRACKING_URI: databricks
UV_BRANCH: main
Expand Down
Loading
Loading