Dixing (Dex) Xu commited on
Commit
b49bf3f
·
unverified ·
1 Parent(s): f92d1a2

:wrench: Add Makefile (#26)

Browse files
Files changed (1) hide show
  1. Makefile +50 -0
Makefile ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: docker docker-build docker-run install clean
2
+
3
+ # Docker image name
4
+ IMAGE_NAME = aide
5
+
6
+ # Python version and venv
7
+ PYTHON = python3.10
8
+ VENV_NAME = .venv
9
+
10
+ # Default directories for logs and workspaces
11
+ WORKSPACE_BASE ?= $(PWD)/workspaces
12
+ LOGS_DIR ?= $(PWD)/logs
13
+
14
+ # Virtual environment installation
15
+ install:
16
+ @echo "Creating virtual environment..."
17
+ @$(PYTHON) -m venv $(VENV_NAME)
18
+ @echo "Installing dependencies..."
19
+ @. $(VENV_NAME)/bin/activate && \
20
+ pip install --upgrade pip && \
21
+ pip install -r requirements.txt && \
22
+ pip install -e .
23
+ @echo "Installation complete. Activate the virtual environment with: source $(VENV_NAME)/bin/activate"
24
+
25
+ # Docker commands combined
26
+ docker: docker-build docker-run
27
+
28
+ # Build Docker image
29
+ docker-build:
30
+ docker build -t $(IMAGE_NAME) .
31
+
32
+ # Run Docker container
33
+ docker-run:
34
+ @mkdir -p "$(LOGS_DIR)" "$(WORKSPACE_BASE)"
35
+ docker run -it --rm \
36
+ -v "$(LOGS_DIR):/app/logs" \
37
+ -v "$(WORKSPACE_BASE):/app/workspaces" \
38
+ -v "$(PWD)/aide/example_tasks:/app/data" \
39
+ -e OPENAI_API_KEY="$(OPENAI_API_KEY)" \
40
+ $(IMAGE_NAME) \
41
+ data_dir=/app/data/house_prices \
42
+ goal="Predict the sales price for each house" \
43
+ eval="Use the RMSE metric between the logarithm of the predicted and observed values."
44
+
45
+ # Clean up
46
+ clean:
47
+ @echo "Cleaning up..."
48
+ rm -rf $(VENV_NAME)
49
+ rm -rf workspaces/* logs/*
50
+ docker rmi $(IMAGE_NAME) || true