LLaVA-OneVision-1.5-8B-Instruct sft阶段的训练问题
Describe the bug What the bug is, and how to reproduce, better with screenshots(描述bug以及复现过程,最好有截图)
你好,我遇到以下问题
在使用Qwen2.5_vl_7B_Instruct 以及 Qwen3_vl_8B_Instruct 两个基模能够正常完成sft阶段的全参训练,但是在使用LLaVA-OneVision-1.5-8B-Instruct进行全参训练的过程中却遇到以下问题。
报错信息如下:
[rank0]: Traceback (most recent call last):
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/cli/sft.py", line 20, in
[rank0]: sft_main()
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/llm/train/sft.py", line 364, in sft_main
[rank0]: return SwiftSft(args).main()
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/llm/base.py", line 49, in main
[rank0]: result = self.run()
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/ray/base.py", line 170, in wrapper
[rank0]: return func(self, *args, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/llm/train/sft.py", line 209, in run
[rank0]: return self.train(trainer)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/llm/train/sft.py", line 257, in train
[rank0]: trainer.train(trainer.args.resume_from_checkpoint)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/trainers/mixin.py", line 821, in train
[rank0]: res = super().train(*args, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/transformers/trainer.py", line 2206, in train
[rank0]: return inner_training_loop(
[rank0]: File "/usr/local/lib/python3.10/dist-packages/transformers/trainer.py", line 2548, in _inner_training_loop
[rank0]: tr_loss_step = self.training_step(model, inputs, num_items_in_batch)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/trainers/trainers.py", line 415, in training_step
[rank0]: return super().training_step(model, inputs, *args, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/transformers/trainer.py", line 3797, in training_step
[rank0]: self.accelerator.backward(loss, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/accelerate/accelerator.py", line 2844, in backward
[rank0]: self.deepspeed_engine_wrapped.backward(loss, sync_gradients=self.sync_gradients, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/accelerate/utils/deepspeed.py", line 270, in backward
[rank0]: self.engine.backward(loss, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/deepspeed/utils/nvtx.py", line 20, in wrapped_fn
[rank0]: ret_val = func(*args, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/deepspeed/runtime/engine.py", line 2323, in backward
[rank0]: self._do_optimizer_backward(loss, retain_graph)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/deepspeed/runtime/engine.py", line 2269, in _do_optimizer_backward
[rank0]: self.optimizer.backward(loss, retain_graph=retain_graph)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/deepspeed/utils/nvtx.py", line 20, in wrapped_fn
[rank0]: ret_val = func(*args, **kwargs)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/deepspeed/runtime/zero/stage3.py", line 2318, in backward
[rank0]: self.loss_scaler.backward(loss.float(), retain_graph=retain_graph)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/deepspeed/runtime/fp16/loss_scaler.py", line 65, in backward
[rank0]: scaled_loss.backward(retain_graph=retain_graph)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/_tensor.py", line 648, in backward
[rank0]: torch.autograd.backward(
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/autograd/init.py", line 353, in backward
[rank0]: _engine_run_backward(
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/autograd/graph.py", line 824, in _engine_run_backward
[rank0]: return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/autograd/function.py", line 307, in apply
[rank0]: return user_fn(self, *args)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/utils/checkpoint.py", line 320, in backward
[rank0]: torch.autograd.backward(outputs_with_grad, args_with_grad)
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/autograd/init.py", line 353, in backward
[rank0]: _engine_run_backward(
[rank0]: File "/usr/local/lib/python3.10/dist-packages/torch/autograd/graph.py", line 824, in _engine_run_backward
[rank0]: return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
[rank0]: RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retain_graph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.
Train: 0%| | 0/40000 [00:02<?, ?it/s]
E1217 14:36:29.827000 6531 torch/distributed/elastic/multiprocessing/api.py:874] failed (exitcode: 1) local_rank: 0 (pid: 6553) of binary: /usr/bin/python3
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 896, in
main()
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 355, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 892, in main
run(args)
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 883, in run
elastic_launch(
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 139, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 270, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
/usr/local/lib/python3.10/dist-packages/swift/cli/sft.py FAILED
Failures: <NO_OTHER_FAILURES>
Root Cause (first observed failure): [0]: time : 2025-12-17_14:36:29 host : rank : 0 (local_rank: 0) exitcode : 1 (pid: 6553) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
sft阶段的训练代码如下:
MAX_PIXELS=1003520
NPROC_PER_NODE=8
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
swift sft
--model /mnt/foundational_model/LLaVA-OneVision-1.5-8B-Instruct
--train_type full
--model_type llava_onevision1_5
--dataset /mnt/datasets/rl_1_image/train_label_updated.jsonl
--torch_dtype bfloat16
--freeze_llm false
--freeze_vit false
--freeze_aligner false
--max_steps 40000
--per_device_train_batch_size 1
--learning_rate 1e-5
--vit_lr 5e-6
--aligner_lr 5e-6
--gradient_accumulation_steps 2
--gradient_checkpointing true
--vit_gradient_checkpointing true
--save_steps 10000
--logging_steps 5
--max_length 10000
--warmup_ratio 0.05
--dataloader_num_workers 8
--dataset_num_proc 8
--save_total_limit 20
--save_only_model true
--deepspeed zero3
--output_dir /mnt/LLaVA_first_label
--loss_scale all
--attn_impl flash_attn
报错信息显示以下三个能够降低显存的参数存在冲突,另外以上报错信息在全参训练的时候出现,在lora训练的时候未出现
--gradient_checkpointing true
--vit_gradient_checkpointing true
--deepspeed zero3 \
我尝试了以下方式1和方式2,能够进行训练,但一段时间后就都会出现oom爆显存的问题
方式1:
--gradient_checkpointing false
--vit_gradient_checkpointing false
--deepspeed zero3(zero2、zero1) \
方式2:
--gradient_checkpointing ture
--vit_gradient_checkpointing ture \
Your hardware and system info Write your system info like CUDA version/system/GPU/torch version here(在这里给出硬件信息和系统信息,如CUDA版本,系统,GPU型号和torch版本等)
CUDA版本12.4 GPU型号A800 torch版本2.7.1 另外LLaVA-OneVision-1.5-8B-Instruct 对transformers 版本有特定的需求,4.53.1 和4.53.2我试过是可以的,但是最新的transformers版本应该是不适配 具体版本信息如下:
Package Version
absl-py 2.3.1 accelerate 1.12.0 addict 2.4.0 aiofiles 24.1.0 aiohappyeyeballs 2.6.1 aiohttp 3.13.2 aiosignal 1.4.0 aliyun-python-sdk-core 2.16.0 aliyun-python-sdk-kms 2.16.5 annotated-doc 0.0.4 annotated-types 0.7.0 antlr4-python3-runtime 4.9.3 anyio 4.12.0 astor 0.8.1 async-timeout 5.0.1 attrdict 2.0.1 attrs 25.4.0 av 16.0.1 binpacking 1.5.2 blake3 1.0.8 blinker 1.4 brotli 1.2.0 cachetools 6.2.2 cbor2 5.7.1 certifi 2025.11.12 cffi 2.0.0 charset-normalizer 3.4.4 click 8.2.1 cloudpickle 3.1.2 compressed-tensors 0.10.2 contourpy 1.3.2 cpm-kernels 1.0.11 crcmod 1.7 cryptography 3.4.8 cupy-cuda12x 13.6.0 cycler 0.12.1 dacite 1.9.2 datasets 3.3.2 dbus-python 1.2.18 deepspeed 0.17.6 depyf 0.19.0 dill 0.3.8 diskcache 5.6.3 distro 1.7.0 distro-info 1.1+ubuntu0.2 dnspython 2.8.0 einops 0.8.1 email-validator 2.3.0 exceptiongroup 1.3.1 fastapi 0.124.0 fastapi-cli 0.0.16 fastapi-cloud-cli 0.6.0 fastar 0.8.0 fastrlock 0.8.3 ffmpy 1.0.0 filelock 3.20.0 flash_attn 2.7.4.post1 fonttools 4.61.0 frozenlist 1.8.0 fsspec 2024.12.0 future 1.0.0 gguf 0.17.1 gradio 5.50.0 gradio_client 1.14.0 groovy 0.1.2 grpcio 1.76.0 h11 0.16.0 hf-xet 1.2.0 hjson 3.1.0 httpcore 1.0.9 httplib2 0.20.2 httptools 0.7.1 httpx 0.28.1 huggingface-hub 0.36.0 idna 3.11 importlib-metadata 4.6.4 interegular 0.3.3 jeepney 0.7.1 jieba 0.42.1 Jinja2 3.1.6 jiter 0.12.0 jmespath 0.10.0 joblib 1.5.2 json_repair 0.54.2 jsonschema 4.25.1 jsonschema-specifications 2025.9.1 keyring 23.5.0 kiwisolver 1.4.9 lark 1.2.2 latex2sympy2_extended 1.0.6 launchpadlib 1.10.16 lazr.restfulclient 0.14.4 lazr.uri 1.0.6 llguidance 0.7.30 llvmlite 0.44.0 lm-format-enforcer 0.10.12 Markdown 3.10 markdown-it-py 4.0.0 MarkupSafe 3.0.3 math-verify 0.5.2 matplotlib 3.10.7 mdurl 0.1.2 mistral_common 1.8.6 modelscope 1.32.0 more-itertools 8.10.0 mpmath 1.3.0 ms_swift 3.11.0 msgpack 1.1.2 msgspec 0.20.0 multidict 6.7.0 multiprocess 0.70.16 networkx 3.4.2 ninja 1.13.0 nltk 3.9.2 numba 0.61.2 numpy 2.2.6 nvidia-cublas-cu12 12.6.4.1 nvidia-cuda-cupti-cu12 12.6.80 nvidia-cuda-nvrtc-cu12 12.6.77 nvidia-cuda-runtime-cu12 12.6.77 nvidia-cudnn-cu12 9.5.1.17 nvidia-cufft-cu12 11.3.0.4 nvidia-cufile-cu12 1.11.1.6 nvidia-curand-cu12 10.3.7.77 nvidia-cusolver-cu12 11.7.1.2 nvidia-cusparse-cu12 12.5.4.2 nvidia-cusparselt-cu12 0.6.3 nvidia-ml-py 13.590.44 nvidia-nccl-cu12 2.26.2 nvidia-nvjitlink-cu12 12.6.85 nvidia-nvtx-cu12 12.6.77 oauthlib 3.2.0 omegaconf 2.3.0 openai 1.90.0 opencv-python-headless 4.12.0.88 orjson 3.11.5 oss2 2.19.1 outlines_core 0.2.10 packaging 25.0 pandas 2.3.3 partial-json-parser 0.2.1.1.post7 peft 0.16.0 pillow 11.3.0 pip 22.0.2 prometheus_client 0.23.1 prometheus-fastapi-instrumentator 7.1.0 propcache 0.4.1 protobuf 6.33.2 psutil 7.1.3 py-cpuinfo 9.0.0 pyarrow 22.0.0 pybase64 1.4.3 pycountry 24.6.1 pycparser 2.23 pycryptodome 3.23.0 pydantic 2.12.3 pydantic_core 2.41.4 pydantic-extra-types 2.10.6 pydub 0.25.1 Pygments 2.19.2 PyGObject 3.42.1 PyJWT 2.3.0 pyparsing 3.2.5 python-apt 2.4.0+ubuntu4 python-dateutil 2.9.0.post0 python-dotenv 1.2.1 python-json-logger 4.0.0 python-multipart 0.0.20 pytz 2025.2 PyYAML 5.4.1 pyzmq 27.1.0 qwen-vl-utils 0.0.14 ray 2.52.1 referencing 0.37.0 regex 2025.11.3 requests 2.32.5 rich 14.2.0 rich-toolkit 0.17.0 rignore 0.7.6 rouge 1.0.1 rpds-py 0.30.0 ruff 0.14.8 safehttpx 0.1.7 safetensors 0.7.0 scipy 1.15.3 SecretStorage 3.3.1 semantic-version 2.10.0 sentencepiece 0.2.1 sentry-sdk 2.47.0 setuptools 59.6.0 shellingham 1.5.4 simplejson 3.20.2 six 1.16.0 sniffio 1.3.1 sortedcontainers 2.4.0 soundfile 0.13.1 soxr 1.0.0 ssh-import-id 5.11 starlette 0.50.0 sympy 1.14.0 tensorboard 2.20.0 tensorboard-data-server 0.7.2 tiktoken 0.12.0 timm 1.0.22 tokenizers 0.21.4 tomli 2.3.0 tomlkit 0.13.3 torch 2.7.1 torchaudio 2.7.1 torchvision 0.22.1 tqdm 4.67.1 transformers 4.53.2 transformers-stream-generator 0.0.5 triton 3.3.1 trl 0.20.0 typer 0.20.0 typing_extensions 4.15.0 typing-inspection 0.4.2 tzdata 2025.2 ufw 0.36.1 unattended-upgrades 0.1 urllib3 2.6.1 uvicorn 0.38.0 uvloop 0.22.1 vllm 0.10.0 wadllib 1.3.6 watchfiles 1.1.1 websockets 15.0.1 Werkzeug 3.1.4 wheel 0.37.1 xformers 0.0.31 xgrammar 0.1.21 xxhash 3.6.0 yarl 1.22.0 zipp 1.0.0 zstandard 0.25.0
Additional context Add any other context about the problem here(在这里补充其他信息) 希望能够得到反馈,十分感谢
数据格式啥样的?
数据格式啥样的?
训练数据包含图片和文本,组织格式是按照swift所提供的标准的多模态的格式进行组织的
示例如下:
{"messages": [{"role": "system", "content": "You are a forensic analyst specializing ..........."}, {"role": "user", "content": "Given the news content: 'A Victorian court decided on Friday that former AFL player agent Ricky Nixon can publish his tellall book despite Kim Duthie s push to ban it' and the associated image
前面的环境,方便改成torch 2.8.0, deepspeed 0.16.9跑一下吗?
前面的环境,方便改成torch 2.8.0, deepspeed 0.16.9跑一下吗? 更新环境后仍显示该问题,
Loading checkpoint shards: 0%| | 0/4 [00:00<?, ?it/s] Loading checkpoint shards: 25%|██▌ | 1/4 [00:01<00:03, 1.12s/it] Loading checkpoint shards: 50%|█████ | 2/4 [00:02<00:02, 1.08s/it] Loading checkpoint shards: 75%|███████▌ | 3/4 [00:03<00:01, 1.08s/it] Loading checkpoint shards: 100%|██████████| 4/4 [00:03<00:00, 1.14it/s] Loading checkpoint shards: 100%|██████████| 4/4 [00:03<00:00, 1.05it/s] [INFO:swift] model_info: ModelInfo(model_type='llava_onevision1_5', model_dir='foundational_model/LLaVA-OneVision-1.5-8B-Instruct', torch_dtype=torch.bfloat16, max_model_len=32768, quant_method=None, quant_bits=None, rope_scaling=None, is_moe_model=False, config=Llavaonevision1_5Config { "architectures": [ "LLaVAOneVision1_5_ForConditionalGeneration" ], "auto_map": { "AutoConfig": "configuration_llavaonevision1_5.Llavaonevision1_5Config", "AutoModel": "modeling_llavaonevision1_5.LLaVAOneVision1_5_ForConditionalGeneration", "AutoModelForCausalLM": "modeling_llavaonevision1_5.LLaVAOneVision1_5_ForConditionalGeneration" }, "hidden_size": 4096, "image_token_id": 151655, "model_type": "llavaonevision1_5", "pad_token_id": 151643, "text_config": { "attention_bias": false, "attention_dropout": 0.0, "head_dim": 128, "hidden_act": "silu", "hidden_size": 4096, "image_token_id": null, "initializer_range": 0.02, "intermediate_size": 12288, "layer_types": [ "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention" ], "max_position_embeddings": 32768, "max_window_layers": 36, "model_type": "LLaVAOneVision1_5_text", "num_attention_heads": 32, "num_hidden_layers": 36, "num_key_value_heads": 8, "rms_norm_eps": 1e-06, "rope_scaling": null, "rope_theta": 1000000.0, "sliding_window": null, "torch_dtype": "bfloat16", "use_cache": true, "use_sliding_window": false, "video_token_id": null, "vocab_size": 151936 }, "torch_dtype": "bfloat16", "transformers_version": "4.53.2", "video_token_id": 151656, "vision_config": { "depth": 24, "embed_dim": 1024, "hidden_act": "gelu", "hidden_size": 1024, "in_channels": 3, "initializer_range": 0.02, "intermediate_size": 4096, "layer_norm_eps": 1e-05, "model_type": "rice_vit", "num_heads": 16, "patch_size": 14, "spatial_merge_size": 2, "temporal_patch_size": 1, "text_hidden_size": 4096, "torch_dtype": "bfloat16" }, "vision_start_token_id": 151652, "vocab_size": 151936 } , task_type='causal_lm', num_labels=None) [INFO:swift] model.generation_config: GenerationConfig { "bos_token_id": 151643, "eos_token_id": 151645, "max_new_tokens": 64, "pad_token_id": 151643, "repetition_penalty": 1.05 }
[INFO:swift] default_system: 'You are a helpful assistant.'
[INFO:swift] max_length: 10000
[INFO:swift] response_prefix: ''
[INFO:swift] agent_template: hermes
[INFO:swift] norm_bbox: norm1000
[INFO:swift] Setting ROOT_IMAGE_DIR: None. You can adjust this hyperparameter through the environment variable: ROOT_IMAGE_DIR.
[INFO:swift] Setting QWENVL_BBOX_FORMAT: legacy. You can adjust this hyperparameter through the environment variable: QWENVL_BBOX_FORMAT.
[INFO:swift] Start time of running main: 2025-12-18 15:08:19.181050
[INFO:swift] swift.version: 3.10.0
Map (num_proc=8): 0%| | 0/207611 [00:00<?, ? examples/s] Map (num_proc=8): 1%| | 2000/207611 [00:00<00:11, 18685.66 examples/s] Map (num_proc=8): 16%|█▋ | 34000/207611 [00:00<00:00, 190274.68 examples/s] Map (num_proc=8): 32%|███▏ | 66000/207611 [00:00<00:00, 246398.43 examples/s] Map (num_proc=8): 47%|████▋ | 98000/207611 [00:00<00:00, 272922.19 examples/s] Map (num_proc=8): 63%|██████▎ | 130000/207611 [00:00<00:00, 286720.56 examples/s] Map (num_proc=8): 78%|███████▊ | 162000/207611 [00:00<00:00, 295193.53 examples/s] Map (num_proc=8): 94%|█████████▍| 194952/207611 [00:00<00:00, 305291.99 examples/s] Map (num_proc=8): 100%|██████████| 207611/207611 [00:00<00:00, 243528.91 examples/s]
Map (num_proc=8): 0%| | 0/207611 [00:00<?, ? examples/s] Map (num_proc=8): 0%| | 1000/207611 [00:00<00:23, 8757.69 examples/s] Map (num_proc=8): 8%|▊ | 17000/207611 [00:00<00:02, 77804.68 examples/s] Map (num_proc=8): 16%|█▌ | 33000/207611 [00:00<00:01, 98411.13 examples/s] Map (num_proc=8): 24%|██▎ | 49000/207611 [00:00<00:01, 107638.94 examples/s] Map (num_proc=8): 31%|███▏ | 65000/207611 [00:00<00:01, 112554.93 examples/s] Map (num_proc=8): 39%|███▉ | 81000/207611 [00:00<00:01, 115643.58 examples/s] Map (num_proc=8): 47%|████▋ | 97000/207611 [00:01<00:01, 60494.12 examples/s] Map (num_proc=8): 54%|█████▍ | 113000/207611 [00:01<00:01, 71986.00 examples/s] Map (num_proc=8): 62%|██████▏ | 129000/207611 [00:01<00:00, 82388.02 examples/s] Map (num_proc=8): 70%|██████▉ | 145000/207611 [00:01<00:00, 91034.22 examples/s] Map (num_proc=8): 78%|███████▊ | 161000/207611 [00:01<00:00, 98645.31 examples/s] Map (num_proc=8): 85%|████████▌ | 177000/207611 [00:01<00:00, 104048.20 examples/s] Map (num_proc=8): 93%|█████████▎| 193000/207611 [00:02<00:00, 108442.16 examples/s] Map (num_proc=8): 100%|██████████| 207611/207611 [00:02<00:00, 90948.46 examples/s] [INFO:swift] train_dataset: Dataset({ features: ['messages', 'images'], num_rows: 207611 }) [INFO:swift] val_dataset: None [INFO:swift] [INPUT_IDS] [151644, 8948, 198, 2610, 525, 264, 54221, 18237, 57294, 304, 7377, 3687, 53248, 13, 4615, 3383, 374, 311, 23643, 3669, 3589, 369, 11929, 315, 33686, 304, 2176, 5335, 323, 23534, 1467, 13, 151645, 198, 151644, 872, 198, 22043, 279, 3669, 2213, 25, 364, 25300, 98971, 323, 3539, 9809, 1644, 309, 15552, 29903, 8910, 311, 12322, 1435, 6, 323, 279, 5815, 2168, 220, 151652, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151655, 151653, 11, 4486, 2736, 264, 15817, 53248, 6358, 510, 16, 13, 29901, 421, 279, 4453, 3669, 1509, 702, 1012, 25476, 42768, 448, 320, 9693, 33100, 340, 17, 13, 64547, 279, 943, 315, 25476, 60718, 320, 333, 894, 340, 18, 13, 95210, 279, 54215, 5537, 304, 279, 2168, 320, 61456, 30618, 3745, 13934, 340, 19, 13, 64547, 54215, 4244, 304, 279, 1467, 151645, 198, 151644, 77091, 198, 14373, 25476, 42768, 25, 902, 198, 88452, 712, 943, 25, 2713, 198, 1906, 54215, 5537, 25, 6857, 198, 1178, 54215, 4244, 25, 6857, 151645] [INFO:swift] [INPUT] <|im_start|>system You are a forensic analyst specializing in digital media authenticity. Your task is to analyze news items for signs of manipulation in both images and accompanying text.<|im_end|> <|im_start|>user Given the news content: 'Paul Hutchinson and Colette Aram DNA advances helped to capture him' and the associated image <|vision_start|>[151655 * 160]<|vision_end|>, please perform a comprehensive authenticity analysis:
- Determine if the entire news item has been tampered with (yes/no)
- Identify the type of tampering (if any)
- Locate the manipulated region in the image (provide bounding box coordinates)
- Identify manipulated words in the text<|im_end|> <|im_start|>assistant News tampered: no Tamper type: orig Image manipulated region: none Text manipulated words: none<|im_end|> [INFO:swift] [LABELS_IDS] [-100, 8948, 198, 2610, 525, 264, 54221, 18237, 57294, 304, 7377, 3687, 53248, 13, 4615, 3383, 374, 311, 23643, 3669, 3589, 369, 11929, 315, 33686, 304, 2176, 5335, 323, 23534, 1467, 13, 151645, 198, 151644, 872, 198, 22043, 279, 3669, 2213, 25, 364, 25300, 98971, 323, 3539, 9809, 1644, 309, 15552, 29903, 8910, 311, 12322, 1435, 6, 323, 279, 5815, 2168, 220, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 11, 4486, 2736, 264, 15817, 53248, 6358, 510, 16, 13, 29901, 421, 279, 4453, 3669, 1509, 702, 1012, 25476, 42768, 448, 320, 9693, 33100, 340, 17, 13, 64547, 279, 943, 315, 25476, 60718, 320, 333, 894, 340, 18, 13, 95210, 279, 54215, 5537, 304, 279, 2168, 320, 61456, 30618, 3745, 13934, 340, 19, 13, 64547, 54215, 4244, 304, 279, 1467, 151645, 198, 151644, 77091, 198, 14373, 25476, 42768, 25, 902, 198, 88452, 712, 943, 25, 2713, 198, 1906, 54215, 5537, 25, 6857, 198, 1178, 54215, 4244, 25, 6857, 151645] [INFO:swift] [LABELS] [-100 * 1]system You are a forensic analyst specializing in digital media authenticity. Your task is to analyze news items for signs of manipulation in both images and accompanying text.<|im_end|> <|im_start|>user Given the news content: 'Paul Hutchinson and Colette Aram DNA advances helped to capture him' and the associated image [-100 * 162], please perform a comprehensive authenticity analysis:
- Determine if the entire news item has been tampered with (yes/no)
- Identify the type of tampering (if any)
- Locate the manipulated region in the image (provide bounding box coordinates)
- Identify manipulated words in the text<|im_end|> <|im_start|>assistant News tampered: no Tamper type: orig Image manipulated region: none Text manipulated words: none<|im_end|> [INFO:swift] The TrainArguments will be saved in: /mntv10-20251218-150813/args.json [INFO:swift] model: LLaVAOneVision1_5_ForConditionalGeneration( (model): LLaVAOneVision1_5_Model( (visual): RiceTransformerPretrainedModel( (patch_embed): RicePatchEmbed( (proj): Conv2d(3, 1024, kernel_size=(14, 14), stride=(14, 14), bias=False) ) (rotary_pos_emb): RiceRotaryEmbedding() (pre_layernorm): LayerNorm((1024,), eps=1e-05, elementwise_affine=True) (blocks): ModuleList( (0-23): 24 x RiceBlock( (norm1): LayerNorm((1024,), eps=1e-05, elementwise_affine=True) (norm2): LayerNorm((1024,), eps=1e-05, elementwise_affine=True) (attn): RiceFlashAttention2( (qkv): Linear(in_features=1024, out_features=3072, bias=True) (proj): Linear(in_features=1024, out_features=1024, bias=True) ) (mlp): RiceMlp( (fc1): Linear(in_features=1024, out_features=4096, bias=True) (act): GELUActivation() (fc2): Linear(in_features=4096, out_features=1024, bias=True) ) ) ) (merger): RicePatchMerger( (ln_q): LayerNorm((1024,), eps=1e-05, elementwise_affine=True) (mlp): Sequential( (0): Linear(in_features=4096, out_features=4096, bias=True) (1): GELU(approximate='none') (2): Linear(in_features=4096, out_features=4096, bias=True) ) ) ) (language_model): LLaVAOneVision1_5_TextModel( (embed_tokens): Embedding(151936, 4096) (layers): ModuleList( (0-35): 36 x LLaVAOneVision1_5_DecoderLayer( (self_attn): LLaVAOneVision1_5_FlashAttention2( (q_proj): Linear(in_features=4096, out_features=4096, bias=False) (k_proj): Linear(in_features=4096, out_features=1024, bias=False) (v_proj): Linear(in_features=4096, out_features=1024, bias=False) (o_proj): Linear(in_features=4096, out_features=4096, bias=False) (q_norm): LLaVAOneVision1_5_RMSNorm((0,), eps=1e-06) (k_norm): LLaVAOneVision1_5_RMSNorm((0,), eps=1e-06) ) (mlp): LLaVAOneVision1_5_MLP( (gate_proj): Linear(in_features=4096, out_features=12288, bias=False) (up_proj): Linear(in_features=4096, out_features=12288, bias=False) (down_proj): Linear(in_features=12288, out_features=4096, bias=False) (act_fn): SiLU() ) (input_layernorm): LLaVAOneVision1_5_RMSNorm((0,), eps=1e-06) (post_attention_layernorm): LLaVAOneVision1_5_RMSNorm((0,), eps=1e-06) ) ) (norm): LLaVAOneVision1_5_RMSNorm((0,), eps=1e-06) (rotary_emb): LLaVAOneVision1_5_RotaryEmbedding() ) ) (lm_head): Linear(in_features=4096, out_features=151936, bias=False) ) [INFO:swift] model_parameter_info: LLaVAOneVision1_5_ForConditionalGeneration: 8527.2146M Params (8527.2146M Trainable [100.0000%]), 0.0001M Buffers. [INFO:swift] use_reentrant: True [INFO:swift] The logging file will be saved in: /mnt/v10-20251218-150813/logging.jsonl [INFO:swift] Successfully registered post_encode hook: ['LLaVAOneVision1_5_ForConditionalGeneration']. [WARNING:swift] prepare gradient_checkpointing failed: Gradient accumulation steps mismatch: GradientAccumulationPlugin has 1, DeepSpeed config has 2. Using DeepSpeed's value. Parameter Offload: Total persistent parameters: 641056 in 345 params
Train: 0%| | 0/40000 [00:00<?, ?it/s][INFO:swift] use_logits_to_keep: False
loss_type=None was set in the config but it is unrecognised.Using the default loss: ForCausalLMLoss.
[INFO:swift] last_model_checkpoint: None
[INFO:swift] best_model_checkpoint: None
[INFO:swift] images_dir: /mnt/LLaVA_first_label/v10-20251218-150813/images
[rank0]: Traceback (most recent call last):
[rank0]: File "/usr/local/lib/python3.10/dist-packages/swift/cli/sft.py", line 20, in
Train: 0%| | 0/40000 [00:03<?, ?it/s]
E1218 15:08:43.540000 25817 torch/distributed/elastic/multiprocessing/api.py:874] failed (exitcode: 1) local_rank: 0 (pid: 25839) of binary: /usr/bin/python3
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 905, in
main()
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 357, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 901, in main
run(args)
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 892, in run
elastic_launch(
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 143, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 277, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
/usr/local/lib/python3.10/dist-packages/swift/cli/sft.py FAILED
Failures: <NO_OTHER_FAILURES>
Root Cause (first observed failure): [0]: time : 2025-12-18_15:08:43 host : rank : 0 (local_rank: 0) exitcode : 1 (pid: 25839) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
Training finished at Thu Dec 18 03:08:44 PM CST 2025
--per_device_train_batch_size 1 \
--gradient_accumulation_steps 64 \
2 * A100. This works when --gradient_checkpointing false \
我也是遇到同样的问题
实测添加以下选项可解决该问题:
gradient_checkpointing_kwargs: '{"use_reentrant": false}'