Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Universal] - reduce size - removed nvidia, triton - Machine Learning Packages #1014

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d39040b
[Universal] - reduce size - removed nvidia, triton - from M.L.P
gauravsaini04 Apr 2, 2024
99cae06
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 3, 2024
60f52ad
optional installation for torch ( with gpu acc. / without it )
gauravsaini04 Apr 3, 2024
cacebcd
updated threshold for universal image to 10 GB
gauravsaini04 Apr 3, 2024
bd5d3c7
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 7, 2024
dba42b0
[universal] - reduce size - changed acc. to comments
gauravsaini04 Apr 7, 2024
7513abb
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 9, 2024
921e471
[Universal] - shrunk size - amended based on reviews
gauravsaini04 Apr 9, 2024
7da2a00
more changes acc. to comments
gauravsaini04 Apr 10, 2024
fc8cdb1
few more relevant changes..
gauravsaini04 Apr 10, 2024
051f9a1
final changes
gauravsaini04 Apr 16, 2024
eb8dc73
misc change
gauravsaini04 Apr 16, 2024
9f04d72
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 17, 2024
6caba17
changes for comments
gauravsaini04 Apr 17, 2024
9d4f51c
Merge remote-tracking branch 'refs/remotes/origin/universal_reduce_si…
gauravsaini04 Apr 17, 2024
74fc0db
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 19, 2024
7ab2791
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 22, 2024
1e7d94d
change for comment
gauravsaini04 Apr 22, 2024
e330d59
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 Apr 29, 2024
1d2583a
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 May 2, 2024
4873b23
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 May 3, 2024
6445c78
change for running tests
gauravsaini04 May 3, 2024
62a3039
Merge branch 'main' into universal_reduce_size_mlp_remove_nvidia_triton
gauravsaini04 May 6, 2024
f7d754c
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 May 7, 2024
40e3949
[Universal] - not installing gpu accelerated torch pkg now
gauravsaini04 May 7, 2024
0f9f285
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 May 8, 2024
874a2af
correction to install_python_package fn
gauravsaini04 May 8, 2024
79374f3
image size check should fail
gauravsaini04 May 8, 2024
b612e05
Merge branch 'devcontainers:main' into universal_reduce_size_mlp_remo…
gauravsaini04 May 9, 2024
bd2a41e
[Universal]-shrink size issue-changes as suggested
gauravsaini04 May 9, 2024
d1cc881
Merge remote-tracking branch 'refs/remotes/origin/universal_reduce_si…
gauravsaini04 May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/smoke-universal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
uses: ./.github/actions/smoke-test
with:
image: universal
threshold: 14
threshold: 10
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
73 changes: 73 additions & 0 deletions src/universal/.devcontainer/OnCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved

gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
if ! command -v jq &> /dev/null; then
echo "jq not found. Attempting to install...";
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
sudo apt-get update;
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
sudo apt-get install -y jq;
fi;

# Read JSON data from file and remove comments using sed
json=$(sed '/^\s*\/\//d' "./.devcontainer/devcontainer.json")

# Extract the value corresponding to "./local-features/machine-learning-packages"
machine_learning_packages_key_value=$(echo "$json" | jq -r '.features | to_entries[] | select(.key == "./local-features/machine-learning-packages") | .value')
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
# Check if the extracted value is not null
if [ ! -z "${machine_learning_packages_key_value}" ]; then
# Extract the username value from the extracted JSON object
username_value=$(echo "$json" | jq -r '.features."./local-features/machine-learning-packages" // empty | .username // empty')
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
# Check if the username value is empty
if [ ! -z "${username_value}" ]; then
# Username value is not empty;
use_username="${username_value}";
else
use_username="codespace";
fi

sudo_if() {
COMMAND="$*"
if [ "$(id -u)" -eq 0 ] && [ "$use_username" != "root" ]; then
su - "$use_username" -c "$COMMAND"
else
$COMMAND
fi
}

export PATH="$PATH:/root/.local/bin";
install_python_package() {
PACKAGE=${1:-""}
shift # Remove the first argument (PACKAGE) from the list of arguments
# Install the package with any remaining arguments (if provided)
if [ $# -gt 0 ]; then
# Additional arguments are provided (e.g., -f URL)
echo "Installing $PACKAGE with options: $@"
sudo_if /usr/local/python/current/bin/python -m pip install --user --upgrade --no-cache-dir $PACKAGE "$@"
else
# No additional arguments provided
echo "Installing $PACKAGE..."
sudo_if /usr/local/python/current/bin/python -m pip install --user --upgrade --no-cache-dir $PACKAGE
fi
}

sudo mkdir -p /var/lib/apt/lists/partial
sudo chown -R root:root /var/lib/apt/lists
sudo chmod -R 755 /var/lib/apt/lists
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved

if ! command -v lspci &> /dev/null; then
echo "lspci not found. Attempting to install...";
sudo apt-get update;
sudo apt-get install -y pciutils;
fi;

set +e;
GPU=$(lspci | grep -i NVIDIA);
set -e;

if [ -n "$GPU" ]; then
echo "GPU Detected. Installing Torch with GPU support.";
install_python_package torch
else
echo "No GPU Detected. Installing Torch with CPU support.";
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
install_python_package torch -f https://download.pytorch.org/whl/cpu/torch_stable.html;
fi;

fi;
1 change: 1 addition & 0 deletions src/universal/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
// "forwardPorts": [],

// Configure tool-specific properties.
"onCreateCommand": "chmod +x ./.devcontainer/OnCreateCommand.sh; ./.devcontainer/OnCreateCommand.sh;",
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ if [[ "$(python --version)" != "" ]] && [[ "$(pip --version)" != "" ]]; then
install_python_package "matplotlib"
install_python_package "seaborn"
install_python_package "scikit-learn"
install_python_package "torch"
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
install_python_package "requests"
gauravsaini04 marked this conversation as resolved.
Show resolved Hide resolved
install_python_package "plotly"
else
"(*) Error: Need to install python and pip."
fi

echo "Done!"
echo "Done!"
Loading