Skip to content

Commit

Permalink
Update welcome_to_llmware_windows.sh
Browse files Browse the repository at this point in the history
This pull request introduces a Bash script for setting up the LLMWare environment and running selected examples. The script handles the installation of core and optional dependencies, moves selected example scripts to the root directory for easy execution, and provides informative feedback throughout the process. It also includes basic error handling to ensure smooth execution.
  • Loading branch information
AranavMahalpure authored Oct 14, 2024
1 parent 8dd10d5 commit 02d64a7
Showing 1 changed file with 53 additions and 53 deletions.
106 changes: 53 additions & 53 deletions welcome_to_llmware_windows.sh
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
#! /bin/bash
#!/bin/bash

# Welcome to LLMWare script - handles some basic setup for first-time cloning of the repo
# Welcome to the LLMWare script - handles basic setup for first-time cloning of the repo
# Windows version

# Function to handle errors
function error_exit {
echo "Error: $1"
exit 1
}

# Install core dependencies
pip3 install -r ./llmware/requirements.txt
echo "Installing core dependencies..."
pip3 install -r ./llmware/requirements.txt || error_exit "Failed to install core dependencies."

# Install optional dependencies (optional step)
echo "Installing optional dependencies..."
pip3 install -r ./llmware/requirements_extras.txt || echo "Optional dependencies installation skipped or failed."

# Note: this step is optional but adds many commonly-used optional dependencies (including in several examples)
pip3 install -r ./llmware/requirements_extras.txt
# Move selected examples into root path for easy execution from the command line
echo "Moving selected examples to the root path..."
declare -a examples=(
"examples/Getting_Started/welcome_example.py"
"fast_start/rag/*.py"
"examples/UI/gguf_streaming_chatbot.py"
"examples/SLIM-Agents/agent-llmfx-getting-started.py"
"examples/SLIM-Agents/using_slim_extract_model.py"
"examples/SLIM-Agents/using_slim_summary.py"
"examples/Models/bling_fast_start.py"
"examples/Models/dragon_gguf_fast_start.py"
"examples/Prompts/document_summarizer.py"
"examples/Use_Cases/web_services_slim_fx.py"
"examples/Use_Cases/invoice_processing.py"
"examples/Models/using-whisper-cpp-sample-files.py"
"examples/Parsing/parsing_microsoft_ir_docs.py"
"examples/Models/chat_models_gguf_fast_start.py"
"examples/Models/gguf_streaming.py"
)

# Move selected examples into root path for easy execution from command line
scp ./examples/Getting_Started/welcome_example.py .
scp ./fast_start/rag/*.py .
scp ./examples/UI/gguf_streaming_chatbot.py .
scp ./examples/SLIM-Agents/agent-llmfx-getting-started.py .
scp ./examples/SLIM-Agents/using_slim_extract_model.py .
scp ./examples/SLIM-Agents/using_slim_summary.py .
scp ./examples/Models/bling_fast_start.py .
scp ./examples/Models/dragon_gguf_fast_start.py .
scp ./examples/Prompts/document_summarizer.py .
scp ./examples/Use_Cases/web_services_slim_fx.py .
scp ./examples/Use_Cases/invoice_processing.py .
scp ./examples/Models/using-whisper-cpp-sample-files.py .
scp ./examples/Parsing/parsing_microsoft_ir_docs.py .
scp ./examples/Models/chat_models_gguf_fast_start.py .
scp ./examples/Models/gguf_streaming.py .
for example in "${examples[@]}"; do
cp "$example" . || error_exit "Failed to copy $example."
done

echo "Welcome Steps Completed"
echo "1. Installed Core Dependencies"
echo "2. Installed Several Optional Dependencies Useful for Running Examples"
echo "3. Moved selected Getting Started examples into /root path"
echo " -- welcome_example.py"
echo " -- example-1-create_first_library.py"
echo " -- example-2-build_embeddings.py"
echo " -- example-3-prompts_and_models.py"
echo " -- example-4-rag-text-query.py"
echo " -- example-5-rag-semantic-query.py"
echo " -- example-6-rag-multi-step-query.py"
echo " -- gguf_streaming.py"
echo " -- bling_fast_start.py"
echo " -- using_slim_extract_model.py"
echo " -- using_slim_summary.py"
echo " -- dragon_gguf_fast_start.py"
echo " -- invoice_processing.py"
echo " -- gguf_streaming_chatbot.py"
echo " -- agent-llmfx-getting-started.py"
echo " -- whisper-cpp-sample-files.py"
echo " -- web_services_slim_fx.py"
echo " -- parsing_microsoft_ir_docs.py"
echo " -- document_summarizer.py"
echo " -- chat_models_gguf_fast_start.py ."
echo "1. Installed Core Dependencies"
echo "2. Installed Several Optional Dependencies Useful for Running Examples"
echo "3. Moved selected Getting Started examples into /root path"

echo "Selected examples:"
for example in "${examples[@]}"; do
echo " -- $(basename "$example")"
done

echo ""
echo "To run an example from command-line: py welcome_example.py"
echo "To run gguf_streaming_chatbot.py: streamlit run gguf_streaming_chatbot.py"
echo "Note: check the /examples folder for 100+ additional examples"
echo "Note: on first time use, models will be downloaded and cached locally"
echo "Note: open up the examples and edit for more configuration options"
echo "To run an example from the command line: py welcome_example.py"
echo "To run gguf_streaming_chatbot.py: streamlit run gguf_streaming_chatbot.py"
echo "Note: Check the /examples folder for 100+ additional examples."
echo "Note: On first-time use, models will be downloaded and cached locally."
echo "Note: Open up the examples and edit for more configuration options."
echo ""

echo "Running welcome_example.py"
py welcome_example.py
echo "Running welcome_example.py..."
py welcome_example.py || error_exit "Failed to run welcome_example.py."

# keeps bash console open (may be in separate window)
bash
# Keeps the bash console open (may be in a separate window)
exec bash

1 comment on commit 02d64a7

@doberst
Copy link
Contributor

@doberst doberst commented on 02d64a7 Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AranavMahalpure - unfortunately, I am getting an error on line 22 when running the script - 'unexpected (' in the declare statement. It is on a Windows 11 machine from default Windows shell. Could you please check out and see if you can replicate and fix? If we can't find a good quick fix, then I will revert back to the original script (which is not as elegant as the one you wrote, but is solid and tested on multiple Windows environments) ... thanks!

Please sign in to comment.