Removed flash-attn as dependency because it's hard to install properly
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -70,13 +70,7 @@ COPY --from=train-env /root/venvs/train /root/venvs/train
|
||||
COPY --from=sia-env /root/venvs/sia /root/venvs/sia
|
||||
COPY --from=web-build /app/dist /root/static/
|
||||
|
||||
RUN for venv in /root/venvs/*/bin; do \
|
||||
echo "export PATH=\"$venv:\$PATH\"" >> /etc/profile.d/sia.sh ; \
|
||||
done
|
||||
RUN for venv in /root/venvs/*/bin; do \
|
||||
echo "export PATH=\"$venv:\$PATH\"" > "/etc/profile.d/venv_$(basename "$(dirname "$venv")").sh" \
|
||||
done
|
||||
WORKDIR /root/desktop
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "-l", "-c"]
|
||||
CMD ["/root/sia/scripts/restart.sh"]
|
||||
ENTRYPOINT ["/bin/bash", "-c"]
|
||||
CMD ["/root/sia/scripts/install.sh; /bin/bash -lc /root/sia/scripts/restart.sh"]
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=78", "wheel>=0.45.0", "packaging>=24.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "sia"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
"accelerate>=0.26.0",
|
||||
"aiohttp>=3.8.0",
|
||||
"bitsandbytes>=0.41.0",
|
||||
"dotenv-python>=0.0.1",
|
||||
"flash-attn>=2.0.0",
|
||||
"huggingface_hub>=0.16.0",
|
||||
"lxml>=4.9.0",
|
||||
"mistral-common>=1.0.0",
|
||||
"mistralai>=0.0.7",
|
||||
"openai>=1.0.0",
|
||||
"psutil>=5.9.0",
|
||||
"python-dotenv>=1.0.0",
|
||||
"tiktoken>=0.4.0",
|
||||
"torch>=2.0.0",
|
||||
"transformers>=4.30.0"
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
sia = "sia.__main__:main"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["sia"]
|
||||
@@ -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
|
||||
@@ -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..."
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd "/root/desktop"
|
||||
while true; do
|
||||
"/root/sia/scripts/install.sh"
|
||||
sia
|
||||
EXIT_CODE=$?
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
29
setup.py
Normal file
29
setup.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="sia",
|
||||
version="0.1.0",
|
||||
packages=find_packages(),
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'sia=sia.__main__:main',
|
||||
],
|
||||
},
|
||||
install_requires=[
|
||||
'torch>=2.0.0',
|
||||
'accelerate>=0.26.0',
|
||||
'aiohttp>=3.8.0',
|
||||
'bitsandbytes>=0.41.0',
|
||||
'dotenv-python>=0.0.1',
|
||||
'huggingface_hub>=0.16.0',
|
||||
'lxml>=4.9.0',
|
||||
'mistral-common>=1.0.0',
|
||||
'mistralai>=0.0.7',
|
||||
'openai>=1.0.0',
|
||||
'psutil>=5.9.0',
|
||||
'python-dotenv>=1.0.0',
|
||||
'tiktoken>=0.4.0',
|
||||
'transformers>=4.30.0',
|
||||
],
|
||||
python_requires='>=3.10',
|
||||
)
|
||||
@@ -37,7 +37,6 @@ class QwQLlmEngine(LlmEngine):
|
||||
model_path,
|
||||
return_dict=True,
|
||||
device_map="auto",
|
||||
attn_implementation="flash_attention_2",
|
||||
use_cache=True,
|
||||
quantization_config=quantization_config,
|
||||
)
|
||||
|
||||
@@ -24,11 +24,5 @@ setup(
|
||||
'black>=22.0.0',
|
||||
'flake8>=4.0.0'
|
||||
],
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Intended Audience :: Developers',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.10',
|
||||
],
|
||||
python_requires='>=3.10',
|
||||
)
|
||||
@@ -30,11 +30,5 @@ setup(
|
||||
'unsloth>=2025.3',
|
||||
'vllm>=0.8',
|
||||
],
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Intended Audience :: Developers',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.10',
|
||||
],
|
||||
python_requires='>=3.10',
|
||||
)
|
||||
Reference in New Issue
Block a user