Skip to content

Commit

Permalink
feat: make setup more robust by exiting if env activation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunes5thmoon committed Aug 26, 2024
1 parent b600a8c commit 1ce7dec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This is a GPU-hungry exercise so you're going to need all the GPU memory you can
Next, run the setup script. It might take a few minutes.
```
cd 08_knowledge_extraction
sh setup.sh
bash setup.sh
```
This will:
- Create a `conda` environment for this exercise
Expand Down
11 changes: 7 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ conda create -n 08_knowledge_extraction -y python=3.11
eval "$(conda shell.bash hook)"
conda activate 08_knowledge_extraction
# Check if the environment is activated
echo "Environment activated: $(which python)"

if [[ "$CONDA_DEFAULT_ENV" == "08_knowledge_extraction" ]]; then
echo "Environment activated successfully for package installation"
else
echo "Failed to activate environment for package installation. Dependencies not installed!"
exit
fi
echo "Training classifier model"
conda install -y pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia
pip install -r requirements.txt

echo "Training classifier model"
python extras/train_classifier.py

conda deactivate

0 comments on commit 1ce7dec

Please sign in to comment.