fix: multiple bug fixes - remove unused imports, fix typo, fix dataset paths, add ai command fallback

This commit is contained in:
Christian Medina
2026-06-30 18:48:46 -04:00
parent 75aeeeb20a
commit 97004261f5
5 changed files with 20017 additions and 8 deletions

View File

@@ -12,8 +12,12 @@ echo ""
# Unload AI model to free VRAM
echo "=== Unloading AI model ==="
if command -v ai &> /dev/null; then
ai none
sleep 2
else
echo "Warning: 'ai' command not found, skipping AI unload"
fi
# Check Python
if ! command -v python3 &> /dev/null; then

View File

@@ -50,7 +50,7 @@ mixed_precision: bf16
plugin: deepspeed
huggingface_hub:
token: null
deeepspeed_config:
deepspeed_config:
zero_optimization:
stage: 3
offload_optimizer:

View File

@@ -22,15 +22,13 @@ def train(config_path):
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
TrainingArguments,
)
from peft import (
prepare_model_for_kbit_training,
LoraConfig,
get_peft_model,
)
from trl import SFTTrainer, SFTConfig
from trl import SFTTrainer
print(f"Loading model: {config['base_model']}")
@@ -61,12 +59,18 @@ def train(config_path):
# Load dataset
from datasets import load_dataset
import os
# Get dataset paths relative to script location
script_dir = Path(__file__).parent.parent
train_path = str(script_dir / ".." / ".." / "training" / "data" / "train.jsonl")
test_path = str(script_dir / ".." / ".." / "training" / "data" / "test.jsonl")
dataset = load_dataset(
"json",
data_files={
"train": config["dataset"][0]["path"].replace("../", ""),
"test": config["dataset"][0]["path"].replace("../", "").replace("combined_20k.jsonl", "test.jsonl"),
"train": train_path,
"test": test_path,
},
)
@@ -99,6 +103,7 @@ def train(config_path):
train_dataset=dataset["train"],
eval_dataset=dataset["test"],
args=training_args,
dataset_text_field="text",
max_seq_length=config["train_params"]["max_seq_length"],
)

1000
training/test.jsonl Normal file

File diff suppressed because it is too large Load Diff

19000
training/train.jsonl Normal file

File diff suppressed because it is too large Load Diff