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. diff --git a/conda/environment.yml b/conda/environment.yml new file mode 100644 index 00000000..7f6deeaa --- /dev/null +++ b/conda/environment.yml @@ -0,0 +1,9 @@ + +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 +variables: + VLLM_USE_V1: 0 # need this to make outlines work diff --git a/conda/install.sh b/conda/install.sh new file mode 100755 index 00000000..6df570e7 --- /dev/null +++ b/conda/install.sh @@ -0,0 +1,71 @@ +#!/bin/bash -e + +CONDA="" +if which mamba > /dev/null +then + CONDA=$(which mamba) +fi +if which conda > /dev/null +then + CONDA=$(which conda) +fi + +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 + + +usage(){ + 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 +} + +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." + exit 1 + ;; + *) + # If unknown (any other) option: + echo "Error: -${OPTARG} unknown." + exit 1 + ;; + esac +done + +if $CONDA env list | grep -q mellea +then + echo "An existing mellea environment was found." + $CONDA env remove $CONDA_OPTIONS -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. +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +$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 + +$CONDA run -n mellea pre-commit install