fix: multiple bug fixes - remove unused imports, fix typo, fix dataset paths, add ai command fallback
This commit is contained in:
@@ -12,8 +12,12 @@ echo ""
|
|||||||
|
|
||||||
# Unload AI model to free VRAM
|
# Unload AI model to free VRAM
|
||||||
echo "=== Unloading AI model ==="
|
echo "=== Unloading AI model ==="
|
||||||
ai none
|
if command -v ai &> /dev/null; then
|
||||||
sleep 2
|
ai none
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "Warning: 'ai' command not found, skipping AI unload"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check Python
|
# Check Python
|
||||||
if ! command -v python3 &> /dev/null; then
|
if ! command -v python3 &> /dev/null; then
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ mixed_precision: bf16
|
|||||||
plugin: deepspeed
|
plugin: deepspeed
|
||||||
huggingface_hub:
|
huggingface_hub:
|
||||||
token: null
|
token: null
|
||||||
deeepspeed_config:
|
deepspeed_config:
|
||||||
zero_optimization:
|
zero_optimization:
|
||||||
stage: 3
|
stage: 3
|
||||||
offload_optimizer:
|
offload_optimizer:
|
||||||
|
|||||||
@@ -22,15 +22,13 @@ def train(config_path):
|
|||||||
from transformers import (
|
from transformers import (
|
||||||
AutoModelForCausalLM,
|
AutoModelForCausalLM,
|
||||||
AutoTokenizer,
|
AutoTokenizer,
|
||||||
BitsAndBytesConfig,
|
|
||||||
TrainingArguments,
|
TrainingArguments,
|
||||||
)
|
)
|
||||||
from peft import (
|
from peft import (
|
||||||
prepare_model_for_kbit_training,
|
|
||||||
LoraConfig,
|
LoraConfig,
|
||||||
get_peft_model,
|
get_peft_model,
|
||||||
)
|
)
|
||||||
from trl import SFTTrainer, SFTConfig
|
from trl import SFTTrainer
|
||||||
|
|
||||||
print(f"Loading model: {config['base_model']}")
|
print(f"Loading model: {config['base_model']}")
|
||||||
|
|
||||||
@@ -61,12 +59,18 @@ def train(config_path):
|
|||||||
|
|
||||||
# Load dataset
|
# Load dataset
|
||||||
from datasets import 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(
|
dataset = load_dataset(
|
||||||
"json",
|
"json",
|
||||||
data_files={
|
data_files={
|
||||||
"train": config["dataset"][0]["path"].replace("../", ""),
|
"train": train_path,
|
||||||
"test": config["dataset"][0]["path"].replace("../", "").replace("combined_20k.jsonl", "test.jsonl"),
|
"test": test_path,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -99,6 +103,7 @@ def train(config_path):
|
|||||||
train_dataset=dataset["train"],
|
train_dataset=dataset["train"],
|
||||||
eval_dataset=dataset["test"],
|
eval_dataset=dataset["test"],
|
||||||
args=training_args,
|
args=training_args,
|
||||||
|
dataset_text_field="text",
|
||||||
max_seq_length=config["train_params"]["max_seq_length"],
|
max_seq_length=config["train_params"]["max_seq_length"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
1000
training/test.jsonl
Normal file
1000
training/test.jsonl
Normal file
File diff suppressed because it is too large
Load Diff
19000
training/train.jsonl
Normal file
19000
training/train.jsonl
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user