mirror of
https://github.com/nod-ai/SHARK-Studio.git
synced 2026-01-09 13:57:54 -05:00
Modify install.sh and update readme.
This commit is contained in:
@@ -12,12 +12,9 @@ git clone https://github.com/NodLabs/dSHARK.git
|
||||
|
||||
## Setup your Python VirtualEnvironment and Dependencies
|
||||
```shell
|
||||
python -m venv shark_venv
|
||||
source shark_venv/bin/activate
|
||||
# Some older pip installs may not be able to handle the recent PyTorch deps
|
||||
python -m pip install --upgrade pip
|
||||
# Install necessary packages (torch-mlir, nodLabs/Shark, ...).
|
||||
./install.sh
|
||||
# Setup venv and install necessary packages (torch-mlir, nodLabs/Shark, ...).
|
||||
./setup_venv.sh
|
||||
# Please activate the venv after installation.
|
||||
```
|
||||
|
||||
### Run a demo script
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
source shark_venv/bin/activate
|
||||
|
||||
pip install -r requirements.txt
|
||||
|
||||
pip install --find-links https://github.com/llvm/torch-mlir/releases torch-mlir
|
||||
pip install --find-links https://github.com/NodLabs/SHARK/releases iree-compiler iree-runtime
|
||||
pip install git+https://github.com/pytorch/functorch.git
|
||||
pip install .
|
||||
38
setup_venv.sh
Executable file
38
setup_venv.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Sets up a venv suitable for running samples.
|
||||
# Recommend getting default 'python' to be python 3. For example on Debian:
|
||||
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
|
||||
# Or launch with python=/some/path
|
||||
TD="$(cd $(dirname $0) && pwd)"
|
||||
VENV_DIR="$TD/shark.venv"
|
||||
if [ -z "$PYTHON" ]; then
|
||||
PYTHON="$(which python)"
|
||||
fi
|
||||
|
||||
echo "Setting up venv dir: $VENV_DIR"
|
||||
echo "Python: $PYTHON"
|
||||
echo "Python version: $("$PYTHON" --version)"
|
||||
|
||||
function die() {
|
||||
echo "Error executing command: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$PYTHON -m venv "$VENV_DIR" || die "Could not create venv."
|
||||
source "$VENV_DIR/bin/activate" || die "Could not activate venv"
|
||||
|
||||
# Upgrade pip and install requirements. 'python' is used here in order to
|
||||
# reference to the python executable from the venv.
|
||||
python -m pip install --upgrade pip || die "Could not upgrade pip"
|
||||
python -m pip install --upgrade -r "$TD/requirements.txt"
|
||||
pip install --find-links https://github.com/llvm/torch-mlir/releases torch-mlir
|
||||
pip install --find-links https://github.com/NodLabs/SHARK/releases iree-compiler iree-runtime
|
||||
pip install git+https://github.com/pytorch/functorch.git
|
||||
pip install transformers
|
||||
pip install .
|
||||
|
||||
Red=`tput setaf 1`
|
||||
Green=`tput setaf 2`
|
||||
echo "${Green}Before running examples activate venv with:"
|
||||
echo " ${Red}source $VENV_DIR/bin/activate"
|
||||
|
||||
Reference in New Issue
Block a user