Skip to content

Commit

Permalink
Merge pull request #614 from milosgajdos/smol-cleanup
Browse files Browse the repository at this point in the history
Small clean up of empty chars and unusued vars.
  • Loading branch information
lukemarsden authored Nov 25, 2024
2 parents 00996bd + 9205f3e commit 89e6547
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 32 deletions.
4 changes: 2 additions & 2 deletions docker-compose.runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ services:
restart: always
build:
context: .
dockerfile: Dockerfile.runner
dockerfile: Dockerfile.runner
network_mode: "host" # So the runner can access the control plane that is running on the host
volumes:
volumes:
- ~/.cache/huggingface:/root/.cache/huggingface
environment:
- RUNNER_ID=local-dev-runner
Expand Down
10 changes: 5 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fi
# Function to gather planned modifications
gather_modifications() {
local modifications=""

if [ "$CLI" = true ]; then
modifications+=" - Install Helix CLI version ${LATEST_RELEASE}\n"
fi
Expand All @@ -309,7 +309,7 @@ gather_modifications() {
modifications+=" - Ensure NVIDIA Docker runtime is installed\n"
modifications+=" - Install Helix Runner version ${LATEST_RELEASE}\n"
fi

echo -e "$modifications"
}

Expand All @@ -318,7 +318,7 @@ ask_for_approval() {
if [ "$AUTO_APPROVE" = true ]; then
return 0
fi

echo "┌───────────────────────────────────────────────────────────────────────────┐"
echo "│ The following modifications will be made to your system: │"
echo "└───────────────────────────────────────────────────────────────────────────┘"
Expand All @@ -331,7 +331,7 @@ ask_for_approval() {
echo
read -p "Do you want to proceed? (y/N) " response
case "$response" in
[yY][eE][sS]|[yY])
[yY][eE][sS]|[yY])
return 0
;;
*)
Expand Down Expand Up @@ -490,7 +490,7 @@ EOF
ENV_FILE="$INSTALL_DIR/.env"
echo -e "\nCreating/updating .env file..."
echo

# Default to localhost if it wasn't passed
if [ -z "$API_HOST" ]; then
API_HOST="http://localhost:8080"
Expand Down
4 changes: 2 additions & 2 deletions runner/helix-llama3.2-instruct-1b-v1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compare this file with
# https://github.com/axolotl-ai-cloud/axolotl/blob/main/examples/llama-3/instruct-lora-8b.yml and
# https://github.com/axolotl-ai-cloud/axolotl/blob/main/examples/llama-3/qlora.yml
# https://github.com/axolotl-ai-cloud/axolotl/blob/main/examples/llama-3/qlora.yml

base_model: unsloth/Llama-3.2-1B-Instruct
model_type: LlamaForCausalLM
Expand Down Expand Up @@ -84,4 +84,4 @@ special_tokens:
datasets:
- path: teknium/GPT4-LLM-Cleaned
type: alpaca
output_dir: ./outputs/qlora-out
output_dir: ./outputs/qlora-out
24 changes: 12 additions & 12 deletions runner/sdxl_finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import json


def do_inference():
getJobURL = os.environ.get("HELIX_NEXT_TASK_URL", None)
readSessionURL = os.environ.get("HELIX_INITIAL_SESSION_URL", "")
Expand All @@ -15,22 +16,19 @@ def do_inference():

if readSessionURL == "":
sys.exit("HELIX_INITIAL_SESSION_URL is not set")

lora_dir = ""

waiting_for_initial_session = True

while waiting_for_initial_session:
response = requests.get(readSessionURL)
if response.status_code != 200:
time.sleep(0.1)
continue

session = json.loads(response.content)

waiting_for_initial_session = False
lora_dir = session["lora_dir"]

session_id = ""

while True:
currentJobData = ""

Expand All @@ -56,16 +54,18 @@ def do_inference():
time.sleep(int(mockDelay))

task = json.loads(currentJobData)
instruction: str = task["prompt"]
session_id = task["session_id"]
dir_path = os.getcwd() + "/runner/fixtures"
print(f" [SESSION_START]session_id={session_id} ", file=sys.stdout, flush=True)
print("steps:\n")
for i in range(1, 101):
print(f"{i}%|\n")
time.sleep(0.1)

print(f" [SESSION_END_LORA_DIR]lora_dir={dir_path} ", file=sys.stdout, flush=True)
print(f"{i}%|\n")
time.sleep(0.1)

print(
f" [SESSION_END_LORA_DIR]lora_dir={dir_path} ", file=sys.stdout, flush=True
)


if __name__ == "__main__":
do_inference()
do_inference()
30 changes: 19 additions & 11 deletions runner/sdxl_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import json
import builtins


def print(*args, **kwargs):
kwargs['flush'] = True
kwargs["flush"] = True
return builtins.print(*args, **kwargs)


def do_inference():
getJobURL = os.environ.get("HELIX_NEXT_TASK_URL", None)
readSessionURL = os.environ.get("HELIX_INITIAL_SESSION_URL", "")
Expand All @@ -20,7 +22,7 @@ def do_inference():

if readSessionURL == "":
sys.exit("HELIX_INITIAL_SESSION_URL is not set")

lora_dir = ""
waiting_for_initial_session = True

Expand All @@ -29,17 +31,19 @@ def do_inference():
if response.status_code != 200:
time.sleep(0.1)
continue

session = json.loads(response.content)
waiting_for_initial_session = False
lora_dir = session["lora_dir"]

if lora_dir != "":
print("🟡🟡🟡 SDXL Lora dir --------------------------------------------------\n")
print(
"🟡🟡🟡 SDXL Lora dir --------------------------------------------------\n"
)
print(lora_dir)

session_id = ""

while True:
currentJobData = ""

Expand All @@ -62,16 +66,20 @@ def do_inference():
time.sleep(int(mockDelay))

task = json.loads(currentJobData)
instruction: str = task["prompt"]
session_id = task["session_id"]
image_path = os.getcwd() + "/runner/fixtures/image.png"
print(f" [SESSION_START]session_id={session_id} ", file=sys.stdout, flush=True)

for i in range(1, 101):
print(f"{i}%|\n")
time.sleep(0.1)

print(f" [SESSION_END_IMAGES]images=[\"{image_path}\"] ", file=sys.stdout, flush=True)
print(f"{i}%|\n")
time.sleep(0.1)

print(
f' [SESSION_END_IMAGES]images=["{image_path}"] ',
file=sys.stdout,
flush=True,
)


if __name__ == "__main__":
do_inference()
do_inference()

0 comments on commit 89e6547

Please sign in to comment.