Skip to content

Commit

Permalink
WIP add code for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavin001 committed Sep 8, 2023
1 parent 6f3216e commit e9eae77
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "0.0.0.0",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/workspace/axolotl/"
}
]
},
{
"name": "train",
"type": "python",
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
# set environment variables
environment:
- WANDB_API_KEY=${WANDB_API_KEY}
ports:
- "5678:5678"
deploy:
resources:
reservations:
Expand Down
18 changes: 11 additions & 7 deletions examples/llama-2/tiny-random.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ strict: false
datasets:
# - path: mhenrichsen/alpaca_2k_test
# type: alpaca
# - path: teknium/GPT4-LLM-Cleaned
# type: alpaca
- path: Glavin001/startup-interviews
- path: teknium/GPT4-LLM-Cleaned
type: alpaca
# - path: Glavin001/startup-interviews
# type: alpaca
dataset_prepared_path: last_run_prepared
# val_set_size: 0.01
val_set_size: 0.1
val_set_size: 0.001
# val_set_size: 0.1
# output_dir: ./lora-out
# output_dir: ./lora-2-out
output_dir: ./lora-5-out
Expand All @@ -35,7 +36,7 @@ sequence_len: 2048
# sequence_len: 256
# sequence_len: 512
# sample_packing: true
sample_packing: false
sample_packing: false # FIXME: disabled until we can fix the bug in callbacks.py

adapter: lora
lora_model_dir:
Expand All @@ -54,11 +55,13 @@ wandb_log_model:
gradient_accumulation_steps: 4
# micro_batch_size: 2
micro_batch_size: 16
# micro_batch_size: 24
# micro_batch_size: 24
# num_epochs: 3
# num_epochs: 0.001
# num_epochs: 0.01
# num_epochs: 1
num_epochs: 5
num_epochs: 1
# num_epochs: 5
optimizer: adamw_bnb_8bit
lr_scheduler: cosine
learning_rate: 0.0002
Expand All @@ -81,6 +84,7 @@ warmup_steps: 10
eval_steps: 10
# eval_steps: 20
# eval_steps: 2
# eval_steps: 1
save_steps:
debug:
deepspeed:
Expand Down
5 changes: 5 additions & 0 deletions scripts/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
from axolotl.utils.tokenization import check_dataset_labels
from axolotl.utils.wandb import setup_wandb_env_vars

# import debugpy
# debugpy.listen(('0.0.0.0', 5678))
# debugpy.wait_for_client()
# debugpy.breakpoint()

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
src_dir = os.path.join(project_root, "src")
sys.path.insert(0, src_dir)
Expand Down
12 changes: 12 additions & 0 deletions src/axolotl/utils/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
from typing import TYPE_CHECKING, Dict, List

import itertools
import evaluate
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -483,3 +484,14 @@ def log_table_from_dataloader(name: str, table_dataloader):
return control

return LogPredictionCallback


def group_sublists_by(lst: List[int], value: int) -> List[List[int]]:
"""
Group sublists of lst by value
"""
grouped = []
for key, group in itertools.groupby(lst, lambda x: x == value):
if key:
grouped.append(list(group))
return grouped

0 comments on commit e9eae77

Please sign in to comment.