-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·74 lines (61 loc) · 2.13 KB
/
setup.sh
File metadata and controls
executable file
·74 lines (61 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Setup script for Sweep 1.5B addon
# Installs Python dependencies and optionally downloads the model
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PACKAGE_DIR="$(dirname "$SCRIPT_DIR")"
echo "Setting up Sweep 1.5B addon..."
# Check Python version
PYTHON_CMD=""
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
else
echo "Error: Python not found. Please install Python 3.10+"
exit 1
fi
PYTHON_VERSION=$($PYTHON_CMD -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
echo "Found Python $PYTHON_VERSION"
# Check if version is >= 3.10
MAJOR=$($PYTHON_CMD -c 'import sys; print(sys.version_info.major)')
MINOR=$($PYTHON_CMD -c 'import sys; print(sys.version_info.minor)')
if [ "$MAJOR" -lt 3 ] || ([ "$MAJOR" -eq 3 ] && [ "$MINOR" -lt 10 ]); then
echo "Error: Python 3.10+ required (found $PYTHON_VERSION)"
exit 1
fi
# Install Python dependencies
echo "Installing Python dependencies..."
$PYTHON_CMD -m pip install --quiet huggingface_hub llama-cpp-python
# Optionally download model now
if [ "$1" = "--download-model" ]; then
echo "Downloading Sweep 1.5B model (this may take a while)..."
MODEL_DIR="$HOME/.stackmemory/models/sweep"
mkdir -p "$MODEL_DIR"
$PYTHON_CMD -c "
from huggingface_hub import hf_hub_download
import os
model_dir = os.path.expanduser('~/.stackmemory/models/sweep')
os.makedirs(model_dir, exist_ok=True)
print('Downloading sweep-next-edit-1.5b.q8_0.v2.gguf...')
path = hf_hub_download(
repo_id='sweepai/sweep-next-edit-1.5B',
filename='sweep-next-edit-1.5b.q8_0.v2.gguf',
repo_type='model',
local_dir=model_dir,
local_dir_use_symlinks=False
)
print(f'Model downloaded to: {path}')
"
echo "Model downloaded successfully!"
else
echo "Skipping model download. Model will be downloaded on first use."
echo "To download now, run: $0 --download-model"
fi
echo ""
echo "Setup complete!"
echo ""
echo "Usage:"
echo " - Import in TypeScript: import { predict } from '@stackmemory/sweep-addon'"
echo " - CLI: stackmemory sweep predict <file>"
echo ""