From 4057bd69dc020f76482eacd5e0b276d0d6994fa1 Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Wed, 27 Aug 2025 01:22:04 -0400 Subject: [PATCH 1/7] feat: conda or mamba-based installation script --- conda/environment.yml | 7 +++++++ conda/install.sh | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 conda/environment.yml create mode 100755 conda/install.sh diff --git a/conda/environment.yml b/conda/environment.yml new file mode 100644 index 00000000..553bd011 --- /dev/null +++ b/conda/environment.yml @@ -0,0 +1,7 @@ + +name: mellea +channels: + - conda-forge +dependencies: + - python=3.12 # note: at the time of writing, xformer (< vllm) has a broken wheel for 3.13. https://github.com/facebookresearch/xformers/issues/740#issuecomment-2753869337 + - uv diff --git a/conda/install.sh b/conda/install.sh new file mode 100755 index 00000000..843b3a2a --- /dev/null +++ b/conda/install.sh @@ -0,0 +1,22 @@ +#!/bin/bash -xe + +conda="" +if $(which mamba) +then + conda=$(which mamba) +fi +if $(which conda) +then + conda=$(which conda) +fi +if [ -z $conda ] +then + echo "Error: conda or mamba is not installed or is not in the PATH." +fi + +echo "using $conda for environment setup" + +$conda env remove -y -n mellea || true +$conda env create -f environment.yml + +$conda run -n mellea uv pip install -e .[all] --group dev From f9669f44abee7d45c8295cd68a8c16b471914eb8 Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Fri, 12 Sep 2025 11:30:28 -0400 Subject: [PATCH 2/7] docs: conda-based installation script --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 29df1897..8fed055f 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ uv run --with mellea docs/examples/tutorial/example.py | MCP | Open In Colab | Mellea + MCP | -### Installing from source +### `uv`-based installation from source Fork and clone the repositoy: @@ -137,7 +137,7 @@ If you are planning to contribute to the repo, it would be good to have all the uv pip install '.[all]' --group dev --group notebook --group docs ``` -or +or ```bash uv sync --all-extras --all-groups @@ -149,6 +149,20 @@ If you want to contribute, ensure that you install the precommit hooks: pre-commit install ``` +### `conda`/`mamba`-based installation from source + +Fork and clone the repositoy: + +```bash +git clone ssh://git@github.com//mellea.git && cd mellea/ +``` + +It comes with an installation script, which does all the commands listed above: + +```bash +conda/install.sh +``` + ## Getting started with validation Mellea supports validation of generation results through a **instruct-validate-repair** pattern. From 9fd5a61552ab9f98e13d4b157c4691e336c72eb2 Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Fri, 12 Sep 2025 11:48:36 -0400 Subject: [PATCH 3/7] fix: reflect README --- conda/install.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/conda/install.sh b/conda/install.sh index 843b3a2a..12731ac9 100755 --- a/conda/install.sh +++ b/conda/install.sh @@ -1,22 +1,33 @@ -#!/bin/bash -xe +#!/bin/bash -e -conda="" -if $(which mamba) +CONDA="" +if which mamba > /dev/null then - conda=$(which mamba) + CONDA=$(which mamba) fi -if $(which conda) +if which conda > /dev/null then - conda=$(which conda) + CONDA=$(which conda) fi -if [ -z $conda ] + +if [ -z $CONDA ] then echo "Error: conda or mamba is not installed or is not in the PATH." + echo "Go to " + echo "* https://github.com/conda-forge/miniforge (open source)" + echo "* https://www.anaconda.com/download/success (registration required)" + echo "to obtain a conda/mamba installer." +else + echo "Using $CONDA for environment setup" fi -echo "using $conda for environment setup" -$conda env remove -y -n mellea || true -$conda env create -f environment.yml +# note: +# this is a portable way (works in linux and osx) to get the directory of this script. +# readlink -ef may not work on osx. +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +$CONDA env create -f $SCRIPT_DIR/environment.yml + +$CONDA run -n mellea uv pip install -e .[all] --group dev --group notebook --group docs -$conda run -n mellea uv pip install -e .[all] --group dev +$CONDA run -n mellea pre-commit install From d781b4881509bbb9cba2b580d80e0286473301af Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Fri, 12 Sep 2025 11:51:05 -0400 Subject: [PATCH 4/7] feat: getopts for -h option --- conda/install.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/conda/install.sh b/conda/install.sh index 12731ac9..edf2ea98 100755 --- a/conda/install.sh +++ b/conda/install.sh @@ -22,6 +22,31 @@ else fi +usage(){ + echo "Usage: install.sh [-h]" + echo + echo "-h : show this help" + exit 1 +} + +while getopts "h" OPTNAME ; do + case "${OPTNAME}" in + h) + usage + ;; + :) + # If expected argument omitted: + echo "Error: -${OPTARG} requires an argument." + exit 1 + ;; + *) + # If unknown (any other) option: + echo "Error: -${OPTARG} unknown." + exit 1 + ;; + esac +done + # note: # this is a portable way (works in linux and osx) to get the directory of this script. # readlink -ef may not work on osx. From 43c7ae218d019819737a9f2cb3c43aa4d574f39e Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Fri, 12 Sep 2025 11:53:19 -0400 Subject: [PATCH 5/7] feat: detects an existing mellea environment and try to remove it --- conda/install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/conda/install.sh b/conda/install.sh index edf2ea98..b6a4acf6 100755 --- a/conda/install.sh +++ b/conda/install.sh @@ -47,6 +47,13 @@ while getopts "h" OPTNAME ; do esac done +if $CONDA env list | grep -q mellea +then + echo "An existing mellea environment was found." + $CONDA env remove -n mellea +fi + + # note: # this is a portable way (works in linux and osx) to get the directory of this script. # readlink -ef may not work on osx. From c22440092dbad666418ae689fc3ac0381c0dc60a Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Fri, 12 Sep 2025 11:55:57 -0400 Subject: [PATCH 6/7] feat: added -y option --- conda/install.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/conda/install.sh b/conda/install.sh index b6a4acf6..6df570e7 100755 --- a/conda/install.sh +++ b/conda/install.sh @@ -23,17 +23,23 @@ fi usage(){ - echo "Usage: install.sh [-h]" + echo "Usage: install.sh [-h] [-y]" echo echo "-h : show this help" + echo "-y : Adds '-y' option to '$CONDA env [create|remove|...]' command arguments." exit 1 } -while getopts "h" OPTNAME ; do +CONDA_OPTIONS="" +while getopts "yh" OPTNAME ; do case "${OPTNAME}" in h) usage ;; + y) + CONDA_OPTIONS="-y" + shift 1 + ;; :) # If expected argument omitted: echo "Error: -${OPTARG} requires an argument." @@ -50,7 +56,7 @@ done if $CONDA env list | grep -q mellea then echo "An existing mellea environment was found." - $CONDA env remove -n mellea + $CONDA env remove $CONDA_OPTIONS -n mellea fi @@ -58,7 +64,7 @@ fi # this is a portable way (works in linux and osx) to get the directory of this script. # readlink -ef may not work on osx. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -$CONDA env create -f $SCRIPT_DIR/environment.yml +$CONDA env create $CONDA_OPTIONS -f $SCRIPT_DIR/environment.yml $CONDA run -n mellea uv pip install -e .[all] --group dev --group notebook --group docs From a0918549dcb94ea4b4ce7f75c9ff07d6d503d960 Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Fri, 12 Sep 2025 11:59:10 -0400 Subject: [PATCH 7/7] fix: enforce VLLM_USE_V1 = 0 --- conda/environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conda/environment.yml b/conda/environment.yml index 553bd011..7f6deeaa 100644 --- a/conda/environment.yml +++ b/conda/environment.yml @@ -5,3 +5,5 @@ channels: dependencies: - python=3.12 # note: at the time of writing, xformer (< vllm) has a broken wheel for 3.13. https://github.com/facebookresearch/xformers/issues/740#issuecomment-2753869337 - uv +variables: + VLLM_USE_V1: 0 # need this to make outlines work