Removed flash-attn as dependency because it's hard to install properly

This commit is contained in:
Niels Geens
2025-04-02 14:42:35 +02:00
parent 78c71ab8b4
commit e573b9ebe7
13 changed files with 147 additions and 118 deletions

View File

@@ -1,15 +0,0 @@
#!/bin/bash
local path="$1"
# Check if the path is already in the environment file
if ! grep -q "$path" /etc/environment; then
# Get current PATH from environment file
current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2)
if [ -z "$current_path" ]; then
# If PATH doesn't exist in the file, create it
echo "PATH=\"\$PATH:$path\"" >> /etc/environment
else
# Replace existing PATH line with updated one
sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment
fi
fi

View File

@@ -39,10 +39,6 @@ if [ ! -d "/root/sia" ]; then
git config --global core.editor vim
fi
# Fixing permissions
echo "Fixing permissions..."
chmod +x /root/sia/scripts/*.sh
# Install Node.js if needed
if ! command -v node &> /dev/null; then
echo "Installing Node.js..."

View File

@@ -1,17 +1,22 @@
#!/bin/bash
echo "Installing ITB tool..."
python3 -m venv "/root/venvs/itb"
/root/venvs/itb/bin/pip install -e /root/sia/tools/itb/
/root/sia/scripts/add_to_environment.sh "/root/venvs/itb/bin"
python3 -m venv /root/venvs/itb
/root/venvs/itb/bin/pip install -e /root/sia/tools/itb
/root/venvs/train/bin/ipython kernel install --name=itb
echo "PATH=\$PATH:/root/venvs/itb/bin" > /etc/profile.d/itb.sh
source /etc/profile.d/itb.sh
echo "Installing Train tool..."
python3 -m venv "/root/venvs/train"
/root/venvs/train/bin/pip install -e /root/sia/tools/train/
python3 -m venv /root/venvs/train
/root/venvs/train/bin/pip install -e /root/sia/tools/train
/root/venvs/train/bin/ipython kernel install --name=train
/root/sia/scripts/add_to_environment.sh "/root/venvs/train/bin"
echo "PATH=\$PATH:/root/venvs/train/bin" > /etc/profile.d/train.sh
source /etc/profile.d/train.sh
echo "Installing SIA core..."
python3 -m venv "/root/venvs/sia"
/root/venvs/sia/bin/pip install -e /root/sia/
/root/sia/scripts/add_to_environment.sh "/root/venvs/sia/bin"
python3 -m venv /root/venvs/sia
/root/venvs/sia/bin/pip install -e /root/sia
/root/venvs/train/bin/ipython kernel install --name=sia
echo "PATH=\$PATH:/root/venvs/sia/bin" > /etc/profile.d/sia.sh
source /etc/profile.d/sia.sh

View File

@@ -10,7 +10,12 @@ function chown_iterations() {
fi
}
function clean_docker() {
docker images -f "dangling=true" -q | xargs -r docker rmi
}
trap chown_iterations EXIT
trap clean_docker EXIT
docker build \
--tag sia \

View File

@@ -2,9 +2,7 @@
set -e
cd "/root/desktop"
while true; do
"/root/sia/scripts/install.sh"
sia
EXIT_CODE=$?

View File

@@ -6,7 +6,63 @@ Usage: setup_binaries.py /path/to/setup.py
import os
import sys
import re
import ast
class SetupVisitor(ast.NodeVisitor):
"""AST visitor that finds setup() function calls and extracts scripts."""
def __init__(self):
self.scripts = []
def visit_Call(self, node):
# Check if this is a call to setup()
if getattr(node.func, 'id', None) == 'setup':
# Look through keyword arguments for scripts
for kw in node.keywords:
if kw.arg == 'scripts':
self._extract_scripts(kw.value)
# Also check entry_points which might contain console_scripts
elif kw.arg == 'entry_points':
self._extract_entry_points(kw.value)
# Continue traversing the AST
self.generic_visit(node)
def _extract_scripts(self, node):
"""Extract script paths from a list or list comprehension."""
if isinstance(node, ast.List):
for elt in node.elts:
if isinstance(elt, ast.Str):
if elt.s.startswith('bin/'):
self.scripts.append(elt.s)
# Handle variables and other expressions by looking for string literals
else:
# This is a simple fallback for complex expressions
script_finder = StringLiteralFinder('bin/')
script_finder.visit(node)
self.scripts.extend(script_finder.matching_strings)
def _extract_entry_points(self, node):
"""Extract console_scripts from entry_points argument."""
# This would need more complex parsing based on how entry_points is specified
# Often it's a dict with 'console_scripts' key or a string with [console_scripts] section
# For this example, we'll just log that we found it
pass
class StringLiteralFinder(ast.NodeVisitor):
"""Find string literals that start with a specific prefix."""
def __init__(self, prefix):
self.prefix = prefix
self.matching_strings = []
def visit_Str(self, node):
if node.s.startswith(self.prefix):
self.matching_strings.append(node.s)
def extract_setup_binaries(setup_path):
"""Extract binary names from a setup.py file and create placeholder files."""
@@ -15,15 +71,20 @@ def extract_setup_binaries(setup_path):
with open(setup_path, 'r') as f:
setup_content = f.read()
# Find all references to scripts in bin/ directory
scripts = re.findall(r"'bin/[^']+?'|\"bin/[^\"]+?\"", setup_content)
# Parse the file
tree = ast.parse(setup_content)
# Find setup() calls and extract scripts
visitor = SetupVisitor()
visitor.visit(tree)
# Get the scripts
scripts = visitor.scripts
if not scripts:
print(f"No bin scripts found in {setup_path}")
return True # Not an error, just no scripts
# Clean up the extracted script names
scripts = [script.strip('\'"') for script in scripts]
# Create placeholder files
base_dir = os.path.dirname(setup_path)
created_count = 0
@@ -61,4 +122,4 @@ if __name__ == "__main__":
sys.exit(1)
success = extract_setup_binaries(setup_path)
sys.exit(0 if success else 1)
sys.exit(0 if success else 1)