Create Python virtual environment (place where python packages are installed) with python3 -m venv ~/camp. Activate the virtual environment (which may have to be done each time you run code) with source ~/camp/bin/activate. Then clone the repo and run python -m pip install -e Steering-LLMs from Python virtual env. Run the code with python3 Steering-LLMs/steerllm/main.py. This will create a folder with the experiment results in Steering-LLMs/data/output.
Adding things to the github involves a few steps. Monospace sections are intended to be run on the commandline/terminal. I am writing this tutorial using terminal commands, but there are GUI options for github as well.
- Install GitHub
- Clone the code
git clone https://github.com/AISC-Steering-LLMs/Steering-LLMs(This may require you to configure your account locally. If this is needed, GitHub should link you to a guide to do so) (Need to change to a folder you are okay with before this. To put in the safety-camp folder inside Downloads folder,cd ~/Downloadsmkdir safety-campcd safety-camp) - Create a branch to make your change on
git branch my-branch(this is stored separately, and can be viewed from the GitHub website. I have configured so that they will be deleted when code is merged) - Change your branch to the newly created one
git checkout my-branch(the default branch is main. This is where your changes will eventually end up. You can go back to main withgit checkout main) - Add your file or make your changes within the folder. This may involve adding more prompts, adding notes, adding a run, or changing code
- add your changes to git
git add .(You can check that the new file/change has been added withgit status) (You may need to add a folder manually withgit add Steering-LLMs/steerllm/data/outputs/2024-01-26_06-14-38/) - commit your changes
git commit -m "Added a new file"(-m indicates the message that you attach, so we can know what your goal is with the change) (At this point, your change is fully added to git) - push your changes to github server with
git push --set-upstream origin my-branch(You should be able to view the changes on the GitHub website at this point. There is a dropdown at top left above the files/folders.) - Periodically run
git pull origin mainto download the latest changes from the server to your computer (It is best to run this before step 3, before creating a new branch) (rungit config pull.rebase trueto make sure this runs properly) - If GitHub says 'X commits behind main' on your branch, reach out to tech team. (You need to checkout your branch and run
git rebase origin/mainfollowed bygit push --force-with-lease. This can cause issues if done improperly) - Create a pull request (Go to GitHub website, Pull request page at the top. Click New pull request. Select your branch. Click Create pull request) (After this someone from the tech team can add your change to the main of GitHub)
git checkout mainthengit pull origin mainto return to the main branch and download any updates, and be ready for any further changes.