Instructions to use entropyinequalityprover/Models_Scripts_MCE-220 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use entropyinequalityprover/Models_Scripts_MCE-220 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
WONG Shing Yin commited on
Upload folder using huggingface_hub
Browse files
qwen3_1.7b_4type_lora_old_format_dataset_a_4096_balanced_higher_maxm.yaml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
base_model: /home/wongshingyin/.cache/huggingface/hub/models--Qwen--Qwen3-1.7B/snapshots/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e
|
| 2 |
+
model_type: AutoModelForCausalLM
|
| 3 |
+
tokenizer_type: AutoTokenizer
|
| 4 |
+
datasets:
|
| 5 |
+
- path: /home/wongshingyin/deepseek_math_sft/ft_using_Axolotl_1/sft_4type_merged_n3to9_remap_completion_no_wrong_maxlen4096_rebalanced_higher_maxm.jsonl
|
| 6 |
+
ds_type: json
|
| 7 |
+
type:
|
| 8 |
+
field_instruction: input
|
| 9 |
+
field_input: __unused
|
| 10 |
+
field_output: output
|
| 11 |
+
format: "{instruction}"
|
| 12 |
+
no_input_format: "{instruction}"
|
| 13 |
+
output_dir: ./outputs/qwen3-1.7b-sft-4type-old-format-lora-dataset-a-4096-balanced-higher-maxm
|
| 14 |
+
dataset_prepared_path: /home/wongshingyin/deepseek_math_sft/ft_using_Axolotl_1/qwen3_1.7b_4type_prepared_4096_old_format_lora_dataset_a_balanced_higher_maxm
|
| 15 |
+
micro_batch_size: 4
|
| 16 |
+
gradient_accumulation_steps: 8
|
| 17 |
+
# 508803 rows / (2*8*4_gpus) = 3975 steps per epoch
|
| 18 |
+
# 1.0 fraction (2 epochs) = 15885 steps
|
| 19 |
+
# 0.6 fraction = 9534 steps
|
| 20 |
+
num_epochs: 2
|
| 21 |
+
learning_rate: 0.00001
|
| 22 |
+
lr_scheduler: cosine
|
| 23 |
+
warmup_steps: 200
|
| 24 |
+
optimizer: adamw_bnb_8bit
|
| 25 |
+
weight_decay: 0.01
|
| 26 |
+
val_set_size: 500
|
| 27 |
+
eval_steps: 0.1
|
| 28 |
+
early_stopping_patience: 3
|
| 29 |
+
load_best_model_at_end: true
|
| 30 |
+
bf16: true
|
| 31 |
+
sequence_len: 4096
|
| 32 |
+
pad_to_sequence_len: true
|
| 33 |
+
group_by_length: false
|
| 34 |
+
max_packed_sequence_len: null
|
| 35 |
+
packing: true
|
| 36 |
+
flash_attention: true
|
| 37 |
+
gradient_checkpointing: true
|
| 38 |
+
heads_k_stride: 1
|
| 39 |
+
seed: 42
|
| 40 |
+
data_seed: 42
|
| 41 |
+
adapter: lora
|
| 42 |
+
lora_r: 64
|
| 43 |
+
lora_alpha: 128
|
| 44 |
+
lora_dropout: 0.05
|
| 45 |
+
lora_target_linear: true
|
| 46 |
+
lora_target_modules:
|
| 47 |
+
- q_proj
|
| 48 |
+
- k_proj
|
| 49 |
+
- v_proj
|
| 50 |
+
- o_proj
|
| 51 |
+
- gate_proj
|
| 52 |
+
- up_proj
|
| 53 |
+
- down_proj
|
| 54 |
+
save_steps: 0.1
|
| 55 |
+
save_total_limit: 10
|
| 56 |
+
logging_steps: 200
|
qwen3_1.7b_training_paths.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Required File Paths for Qwen3-1.7B Phase 7 Training
|
| 2 |
+
|
| 3 |
+
# 1. Base Model ID/Path (Local HF Cache)
|
| 4 |
+
BASE_MODEL: /home/wongshingyin/.cache/huggingface/hub/models--Qwen--Qwen3-1.7B/snapshots/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e
|
| 5 |
+
|
| 6 |
+
# 2. Axolotl YAML Configuration File
|
| 7 |
+
YAML_CONFIG: /home/wongshingyin/deepseek_math_sft/ft_using_Axolotl_1/qwen3_1.7b_4type_lora_old_format_dataset_a_4096_balanced_higher_maxm.yaml
|
| 8 |
+
|
| 9 |
+
# 3. Training Dataset (Dataset A - 4096 Balanced)
|
| 10 |
+
TRAINING_DATASET: /home/wongshingyin/deepseek_math_sft/ft_using_Axolotl_1/sft_4type_merged_n3to9_remap_completion_no_wrong_maxlen4096_rebalanced_higher_maxm.jsonl
|
run_qwen3_1.7b_lora_dataset_a.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Phase 7: Train 1.7B LoRA on Dataset A (4096 Balanced) with Seed 42
|
| 4 |
+
# Stops at the shared training-budget fraction (0.6) = 9534 steps
|
| 5 |
+
|
| 6 |
+
set -euo pipefail
|
| 7 |
+
|
| 8 |
+
REPO_ROOT="/home/wongshingyin/deepseek_math_sft"
|
| 9 |
+
SCRIPT_DIR="${REPO_ROOT}/ft_using_Axolotl_1"
|
| 10 |
+
SESSION_NAME="${SESSION_NAME:-qwen3-1.7b-lora-dataset-a}"
|
| 11 |
+
CONDA_ENV="${CONDA_ENV:-deepseek-math-sft}"
|
| 12 |
+
|
| 13 |
+
YAML_PATH="${SCRIPT_DIR}/qwen3_1.7b_4type_lora_old_format_dataset_a_4096_balanced_higher_maxm.yaml"
|
| 14 |
+
|
| 15 |
+
launch_tmux_if_needed() {
|
| 16 |
+
if [[ -n "${TMUX:-}" || "${INSIDE_TMUX_LAUNCH:-0}" == "1" ]]; then
|
| 17 |
+
return
|
| 18 |
+
fi
|
| 19 |
+
if tmux has-session -t "${SESSION_NAME}" 2>/dev/null; then
|
| 20 |
+
echo "tmux session already exists: ${SESSION_NAME}" >&2
|
| 21 |
+
echo "attach with: tmux attach -t ${SESSION_NAME}" >&2
|
| 22 |
+
exit 1
|
| 23 |
+
fi
|
| 24 |
+
tmux new-session -d -s "${SESSION_NAME}" \
|
| 25 |
+
"cd '${REPO_ROOT}' && INSIDE_TMUX_LAUNCH=1 SESSION_NAME='${SESSION_NAME}' CONDA_ENV='${CONDA_ENV}' CUDA_VISIBLE_DEVICES='${CUDA_VISIBLE_DEVICES:-0,1,2,3}' bash '${SCRIPT_DIR}/run_qwen3_1.7b_lora_dataset_a.sh'"
|
| 26 |
+
echo "launched tmux session: ${SESSION_NAME}"
|
| 27 |
+
echo "attach with: tmux attach -t ${SESSION_NAME}"
|
| 28 |
+
exit 0
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
activate_conda() {
|
| 32 |
+
if ! command -v conda >/dev/null 2>&1; then
|
| 33 |
+
echo "conda command not found; continuing without explicit activation" >&2
|
| 34 |
+
return
|
| 35 |
+
fi
|
| 36 |
+
local conda_base
|
| 37 |
+
conda_base="$(conda info --base)"
|
| 38 |
+
source "${conda_base}/etc/profile.d/conda.sh"
|
| 39 |
+
conda activate "${CONDA_ENV}"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
main() {
|
| 43 |
+
launch_tmux_if_needed
|
| 44 |
+
cd "${REPO_ROOT}"
|
| 45 |
+
activate_conda
|
| 46 |
+
|
| 47 |
+
export AXOLOTL_DO_NOT_TRACK=1
|
| 48 |
+
# Default to GPUs 0,1,2,3 for 1.7B training
|
| 49 |
+
export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3}"
|
| 50 |
+
|
| 51 |
+
echo "[$(date '+%F %T')] starting train 1.7B LoRA (Dataset A): ${YAML_PATH}"
|
| 52 |
+
axolotl train "${YAML_PATH}"
|
| 53 |
+
echo "[$(date '+%F %T')] finished train 1.7B LoRA"
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
main "$@"
|