A Machine-to-Machine Interaction Interface for Lean 4
Go to file
Brando Miranda 3df41c19cd all worked, added pytorch and vllm test 2024-04-29 12:53:54 -07:00
pantograph works on snap now 2024-04-26 19:15:14 -07:00
src@f20ee8dc87 build: Add upstream source 2024-04-11 15:48:36 -07:00
.gitignore feat: expression types and tests 2024-04-22 13:00:06 -07:00
.gitmodules build: Add upstream source 2024-04-11 15:48:36 -07:00
LICENSE Initial commit 2024-04-11 12:37:58 -07:00
README.md all worked, added pytorch and vllm test 2024-04-29 12:53:54 -07:00
build.py feat: expression types and tests 2024-04-22 13:00:06 -07:00
poetry.lock feat: System stub 2024-04-19 16:47:35 -07:00
pyproject.toml added conda install instructions that work for pypantrograph 2024-04-29 12:23:28 -07:00
test_vllm.py all worked, added pytorch and vllm test 2024-04-29 12:53:54 -07:00

README.md

PyPantograph

Python interface to the Pantograph library

Getting started

First initialize the git submodules so that git can keep track of the submodules being used do:

# - initialize the git submodules by preparing the git repository, but it does not clone or fetch them, just init's git's internal configs
git submodule init

Then to clone, fetch & update the submodules code (and also initilize anything you might have forgotten that is specificed in the .gitmodules file):

# - initialize the git submodules so that git can track them and then the update clone/fetches & updates the submodules
git submodule update --init

Then install poetry by following instructions written for the Stanford SNAP cluster or their official instructions. Then once you confirm you have poetry & the initialized git submodules, execute:

poetry build

To run server tests:

python -m pantograph.server

The tests in pantograph/server.py also serve as simple interaction examples

Install 2: With Conda and Pip in the SNAP cluster

# install Lean4 manually (elan and lake)
curl -sSf https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh | sh -s -- -y

# make sure Lean4 tools (lean, lake) are available 
export PATH="$HOME/.elan/bin:$PATH"
echo 'export PATH="$HOME/.elan/bin:$PATH"' >> ~/.bashrc
bash
elan
lake

# create and activate the right python env (this is needed so that poetry build works)
conda create -n pypantograph_env python=3.11 -y
conda activate pypantograph_env

# install poetry with python venv (needs seperate install so poetry & your projs deps don't crash)
mkdir $HOME/.virtualenvs

export VENV_PATH=$HOME/.virtualenvs/venv_for_poetry
export PATH="$VENV_PATH/bin:$PATH"

echo 'export VENV_PATH=$HOME/.virtualenvs/venv_for_poetry' >> ~/.bashrc
echo 'export PATH="$VENV_PATH/bin:$PATH"' >> ~/.bashrc
bash

python3 -m venv $VENV_PATH
$VENV_PATH/bin/pip install -U pip setuptools
$VENV_PATH/bin/pip install poetry

poetry

# build the PyPantograph proj (build the py distribution, py deps and custom (lean4) installs)
ln -s $AFS/PyPantograph $HOME/PyPantograph
cd $HOME/PyPantograph
poetry build

# install pypantograph in editable mode (only pyproject.toml (or setup.py!) needed! Assuming your at the proj root)
pip install -e . 

# confirm intalls
pip list | grep pantograph
pip list | grep vllm
pip list | grep torch

# select freeiest GPU wrt vRAM
export CUDA_VISIBLE_DEVICES=$(nvidia-smi --query-gpu=memory.used --format=csv,nounits,noheader | awk '{print NR-1 " " $1}' | sort -nk2 | head -n1 | cut -d' ' -f1)
echo $CUDA_VISIBLE_DEVICES

# make sure the PyPantrograph server tests by Leni work
# python -m server.py
python $HOME/PyPantograph/pantograph/server.py
python $HOME/PyPantograph/test_vllm.py