(base) [root@localhost ~]# docker exec finetune-trainer find /root/Fine-tuning/backend -name '*.pyc' -delete && docker exec finetune-trainer find /root/Fine-tuning/backend -name '__pycache__' -type d -delete
(base) [root@localhost ~]# 
(base) [root@localhost ~]# docker exec finetune-trainer tail -200 /tmp/train_1e334a57-26f5-4e7e-a961-0a02330fa708.log
[remote_train] === Training job started: 1e334a57-26f5-4e7e-a961-0a02330fa708 ===
[remote_train] model_id=Qwen/Qwen1.5-0.5B, model_type=text
[remote_train] dataset_path=/root/Fine-tuning/backend/data/datasets/data.jsonl
[remote_train] config={"model_id": "Qwen/Qwen1.5-0.5B", "model_type": "text", "dataset_id": "3d5f8808-e71a-449d-94e9-c61c4881b2cf", "peft_method": "adalora", "epochs": 3, "batch_size": 16, "gradient_accumulation": 4, "lear
[remote_train] Dataset file exists: /root/Fine-tuning/backend/data/datasets/data.jsonl
[remote_train] Step 1: Preprocessing dataset...
[remote_train]   task_type=sft, template=auto
[remote_train]   output_path=/root/Fine-tuning/backend/data/processed/1e334a57-26f5-4e7e-a961-0a02330fa708_processed.jsonl
[remote_train]   Selecting engine for model_type=text...
[remote_train]   Engine loaded: TextEngine
[remote_train]   PEFT method: adalora
[remote_train]   Running preprocess_dataset...
[remote_train]   Preprocessing done, output: /root/Fine-tuning/backend/data/processed/1e334a57-26f5-4e7e-a961-0a02330fa708_processed.jsonl
[remote_train] Step 2: Loading model: Qwen/Qwen1.5-0.5B...
[remote_train]   Quantization: None
Loading weights: 100%|██████████| 291/291 [00:04<00:00, 59.39it/s] 
[remote_train]   Model loaded successfully
[remote_train] Step 3: Building PEFT config...
[remote_train] ERROR: AdaLoRA does not work when `total_step` is None, supply a value > 0.
[remote_train] Traceback (most recent call last):
  File "/root/Fine-tuning/backend/app/engines/remote_train.py", line 162, in run_training
    peft_config = engine.get_peft_config(peft_method, config)
  File "/root/Fine-tuning/backend/app/engines/text_engine.py", line 149, in get_peft_config
    return builder(params)
  File "/root/Fine-tuning/backend/app/peft/__init__.py", line 43, in build_adalora_config
    return AdaLoraConfig(
  File "<string>", line 51, in __init__
  File "/opt/conda/lib/python3.10/site-packages/peft/tuners/adalora/config.py", line 102, in __post_init__
    raise ValueError("AdaLoRA does not work when `total_step` is None, supply a value > 0.")
ValueError: AdaLoRA does not work when `total_step` is None, supply a value > 0.

[remote_train] === Training job failed: 1e334a57-26f5-4e7e-a961-0a02330fa708 ===
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/conda/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/Fine-tuning/backend/app/engines/remote_train.py", line 213, in <module>
    main()
  File "/root/Fine-tuning/backend/app/engines/remote_train.py", line 209, in main
    asyncio.run(run_training(job_id, model_id, model_type, dataset_id, config))
  File "/opt/conda/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/conda/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/root/Fine-tuning/backend/app/engines/remote_train.py", line 162, in run_training
    peft_config = engine.get_peft_config(peft_method, config)
  File "/root/Fine-tuning/backend/app/engines/text_engine.py", line 149, in get_peft_config
    return builder(params)
  File "/root/Fine-tuning/backend/app/peft/__init__.py", line 43, in build_adalora_config
    return AdaLoraConfig(
  File "<string>", line 51, in __init__
  File "/opt/conda/lib/python3.10/site-packages/peft/tuners/adalora/config.py", line 102, in __post_init__
    raise ValueError("AdaLoRA does not work when `total_step` is None, supply a value > 0.")
ValueError: AdaLoRA does not work when `total_step` is None, supply a value > 0.
(base) [root@localhost ~]# 
(base) [root@localhost ~]# grep -n 'total_step\|init_r.*target_r' /root/Fine-tuning/backend/app/engines/text_engine.py
190:        # 计算总步数（AdaLoRA 需要在 get_peft_model 之前设置 total_step）
194:        # AdaLoRA 要求 total_step > 0（通过属性名判断而非 isinstance，避免导入路径问题）
195:        if hasattr(peft_config, "init_r") and hasattr(peft_config, "target_r"):
196:            peft_config.total_step = max_steps
396:                    total_steps=state.max_steps or 0,
