forked from argmaxinc/DiffusionKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (56 loc) · 2.28 KB
/
Makefile
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
.PHONY: setup setup-model-repo download-model format clean-package-caches
PIP_COMMAND := pip3
PYTHON_COMMAND := python3
# Define model repository and directories
MODEL_REPO_DIR := ./models/
setup:
@echo "Setting up environment..."
@which $(PIP_COMMAND)
@which $(PYTHON_COMMAND)
@echo "Checking for Homebrew..."
@which brew > /dev/null || (echo "Error: Homebrew is not installed. Install it form here https://brew.sh and try again" && exit 1)
@echo "Homebrew is installed."
@echo "Checking for huggingface-cli..."
@which huggingface-cli > /dev/null || (echo "Installing huggingface-cli..." && brew install huggingface-cli)
@echo "huggingface-cli is installed."
@echo "Checking for git-lfs..."
@which git-lfs > /dev/null || (echo "Installing git-lfs..." && brew install git-lfs)
@echo "git-lfs is installed."
@if [ "$$(uname)" = "Darwin" ]; then \
which trash > /dev/null || (echo "Installing trash..." && brew install trash); \
echo "trash is installed."; \
else \
echo "Skipping trash installation (not macOS)."; \
fi
@echo "Checking for swift-format..."
@which swift-format > /dev/null || (echo "Installing swift-format..." && brew install swift-format)
@echo "swift-format is installed."
@echo "Checking for pre-commit..."
@which pre-commit > /dev/null || (echo "Installing pre-commit..." && brew install pre-commit && pre-commit install)
@echo "pre-commit is installed."
@echo "Done 🚀"
# Download a specific model
download-model:
@if [ -z "$(MODEL)" ]; then \
echo "Error: MODEL is not set. Usage: make download-model MODEL=your-model-repo"; \
exit 1; \
fi
@echo "Setting up repository..."
@mkdir -p $(MODEL_REPO_DIR)
@if [ -d "$(MODEL_REPO_DIR)/$(MODEL)/.git" ]; then \
echo "Repository exists, resetting..."; \
export GIT_LFS_SKIP_SMUDGE=1; \
cd $(MODEL_REPO_DIR)/$(MODEL) && git fetch --all && git reset --hard origin/main && git clean -fdx; \
else \
echo "Repository not found, initializing..."; \
export GIT_LFS_SKIP_SMUDGE=1; \
git clone https://huggingface.co/$(MODEL) $(MODEL_REPO_DIR)/$(MODEL); \
fi
@echo "Downloading model $(MODEL)..."
@cd $(MODEL_REPO_DIR)/$(MODEL) && \
git lfs pull --include="*"
format:
@pre-commit run --all-files
clean-package-caches:
@trash ~/Library/Caches/org.swift.swiftpm/repositories
@trash ~/Library/Developer/Xcode/DerivedData