seungheondoh
commited on
Commit
·
9a6e5af
1
Parent(s):
c4683a3
update
Browse files- script/clone_model.sh +6 -0
- script/clone_repo.sh +1 -1
- script/upload_model.py +29 -0
- script/virtualenv.sh +14 -14
script/clone_model.sh
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
HF_TOKEN="your_token_here"
|
2 |
+
huggingface-cli login --token $HF_TOKEN
|
3 |
+
MODEL_ID="meta-llama/Llama-3.2-1B-Instruct"
|
4 |
+
echo "Downloading ${MODEL_ID}..."
|
5 |
+
git lfs install
|
6 |
+
git clone "https://huggingface.co/${MODEL_ID}"
|
script/clone_repo.sh
CHANGED
@@ -6,4 +6,4 @@ git lfs install
|
|
6 |
git clone $TARGET_REPO
|
7 |
cd $REPO_NAME
|
8 |
source .venv/bin/activate
|
9 |
-
uv pip install -e .
|
|
|
6 |
git clone $TARGET_REPO
|
7 |
cd $REPO_NAME
|
8 |
source .venv/bin/activate
|
9 |
+
uv pip install -e .
|
script/upload_model.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import tarfile
|
3 |
+
from huggingface_hub import HfApi
|
4 |
+
|
5 |
+
# Initialize Hugging Face API
|
6 |
+
api = HfApi()
|
7 |
+
# Define paths and filenames
|
8 |
+
source_dir = "/workspace/logs/llm4music_diffusion/full_channel_concat"
|
9 |
+
output_filename = "full_channel_concat.tar.gz"
|
10 |
+
print(f"Creating tar.gz archive from {source_dir}...")
|
11 |
+
# Create tar.gz archive
|
12 |
+
with tarfile.open(output_filename, "w:gz") as tar:
|
13 |
+
tar.add(source_dir, arcname=os.path.basename(source_dir))
|
14 |
+
print("Archive created successfully")
|
15 |
+
|
16 |
+
# Upload to Hugging Face
|
17 |
+
print("Uploading to Hugging Face Hub...")
|
18 |
+
api.upload_file(
|
19 |
+
path_or_fileobj=output_filename,
|
20 |
+
path_in_repo=output_filename,
|
21 |
+
repo_id="seungheondoh/model_temp", # Replace with your actual repo name
|
22 |
+
repo_type="model"
|
23 |
+
)
|
24 |
+
|
25 |
+
print("Upload completed successfully")
|
26 |
+
|
27 |
+
# Clean up the local tar.gz file
|
28 |
+
os.remove(output_filename)
|
29 |
+
print("Local archive cleaned up")
|
script/virtualenv.sh
CHANGED
@@ -40,21 +40,13 @@ else
|
|
40 |
echo "Virtual environment already exists."
|
41 |
fi
|
42 |
|
|
|
|
|
|
|
43 |
# Upgrade pip
|
44 |
echo "Upgrading pip..."
|
45 |
pip install --upgrade pip
|
46 |
|
47 |
-
# Install uv
|
48 |
-
echo "Installing uv package manager..."
|
49 |
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
50 |
-
|
51 |
-
# Start uv virtualenv
|
52 |
-
echo "Starting uv virtualenv..."
|
53 |
-
uv venv .venv
|
54 |
-
source .venv/bin/activate
|
55 |
-
|
56 |
-
# Ensure uv is in PATH
|
57 |
-
export PATH="$HOME/.cargo/bin:$PATH"
|
58 |
# Get CUDA version number if available
|
59 |
if [ "$CUDA_AVAILABLE" -eq 1 ]; then
|
60 |
CUDA_VERSION_NUM=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n 1 | cut -d'.' -f1)
|
@@ -75,17 +67,25 @@ fi
|
|
75 |
|
76 |
# Install PyTorch 2.6.0
|
77 |
echo "Installing PyTorch 2.6.0..."
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
# Install Hugging Face CLI and tools
|
82 |
echo "Installing Hugging Face CLI and tools..."
|
83 |
-
|
|
|
84 |
# Verify installation
|
85 |
echo "Verifying installation..."
|
86 |
python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
|
|
|
87 |
# Check for Hugging Face CLI
|
88 |
python -c "import huggingface_hub; print('Hugging Face Hub version:', huggingface_hub.__version__)"
|
|
|
89 |
echo "============================================================"
|
90 |
echo "Setup complete!"
|
91 |
echo "To activate this environment, run:"
|
|
|
40 |
echo "Virtual environment already exists."
|
41 |
fi
|
42 |
|
43 |
+
# Activate virtual environment
|
44 |
+
source venv/bin/activate
|
45 |
+
|
46 |
# Upgrade pip
|
47 |
echo "Upgrading pip..."
|
48 |
pip install --upgrade pip
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# Get CUDA version number if available
|
51 |
if [ "$CUDA_AVAILABLE" -eq 1 ]; then
|
52 |
CUDA_VERSION_NUM=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n 1 | cut -d'.' -f1)
|
|
|
67 |
|
68 |
# Install PyTorch 2.6.0
|
69 |
echo "Installing PyTorch 2.6.0..."
|
70 |
+
if [ "$CUDA_AVAILABLE" -eq 1 ]; then
|
71 |
+
echo "Installing PyTorch with CUDA support (${PYTORCH_CUDA})..."
|
72 |
+
pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/${PYTORCH_CUDA}
|
73 |
+
else
|
74 |
+
echo "Installing CPU-only PyTorch..."
|
75 |
+
pip install torch==2.6.0
|
76 |
+
fi
|
77 |
|
78 |
# Install Hugging Face CLI and tools
|
79 |
echo "Installing Hugging Face CLI and tools..."
|
80 |
+
pip install huggingface_hub
|
81 |
+
|
82 |
# Verify installation
|
83 |
echo "Verifying installation..."
|
84 |
python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
|
85 |
+
|
86 |
# Check for Hugging Face CLI
|
87 |
python -c "import huggingface_hub; print('Hugging Face Hub version:', huggingface_hub.__version__)"
|
88 |
+
|
89 |
echo "============================================================"
|
90 |
echo "Setup complete!"
|
91 |
echo "To activate this environment, run:"
|