Skip to content

ValueError: Type fp16 is not supported. #140

@meixiangzhang

Description

@meixiangzhang

When I was configuring the environment, I encountered the following error. It won't work for me to build the virtual environment exactly according to the articles on the official account. Since the graphics card is relatively old, the data type I used is float16 instead of bfloat16. Could it be for this reason? May I ask how I should solve it? The fine-tuning command is:
CUDA_VISIBLE_DEVICES=6 swift sft \ --model ./deepseek-vl2-tiny \ --dataset ./train_image_deepseekvl2.json \ --val_dataset ./val_image_deepseekvl2.json \ --output_dir ./runs/deepseek-vl2-tiny-finetune_mllm_CY_data_20_80_30e \ --num_train_epochs 30 \ --learning_rate 5e-5 \ --max_grad_norm 1 \ --lr_scheduler_type cosine \ --gradient_accumulation_steps 8 \ --lora_rank 8 \ --lora_dropout 0 \ --lora_alpha 16 \ --max_length 4096 \ --save_only_model True \ --eval_steps 1000 \ --save_steps 1000 \ --train_type lora \ --deepspeed zero2 \ --lazy_tokenize True \ --per_device_train_batch_size 2 \ --torch_dtype float16 \ --logging_steps 5
[INFO:swift] model_parameter_info: PeftModelForCausalLM: 3408.4452M Params (37.9438M Trainable [1.1132%]), 0.0008M Buffers. /home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/transformers/deepspeed.py:23: FutureWarning: transformers.deepspeed module is deprecated and will be removed in a future version. Please import deepspeed modules directly from transformers.integrations warnings.warn( Detected kernel version 5.4.0, which is below the recommended minimum of 5.5.0; this can cause the process to hang. It is recommended to upgrade the kernel to the minimum version or higher. [INFO:swift] The logging file will be saved in: /home/zhangmeixiang/code/DeepSeek-VL2-main/runs/deepseek-vl2-tiny-finetune_mllm_CY_data_20_80_30e/v23-20250717-214951/logging.jsonl [INFO:swift] Successfully registered post_encode hook: ['PeftModelForCausalLM'] [2025-07-17 21:50:06,766] [INFO] [real_accelerator.py:203:get_accelerator] Setting ds_accelerator to cuda (auto detect) [WARNING] async_io requires the dev libaio .so object and headers but these were not found. [WARNING] async_io: please install the libaio-dev package with apt [WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found. [WARNING] Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH [WARNING] NVIDIA Inference is only supported on Ampere and newer architectures [WARNING] sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.0 [WARNING] using untested triton version (2.0.0), only 1.0.0 is known to be compatible Traceback (most recent call last): File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/swift/cli/sft.py", line 5, in <module> sft_main() File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/swift/llm/train/sft.py", line 272, in sft_main return SwiftSft(args).main() File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/swift/llm/base.py", line 45, in main result = self.run() File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/swift/llm/train/sft.py", line 139, in run return self.train(trainer) File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/swift/llm/train/sft.py", line 191, in train trainer.train(trainer.args.resume_from_checkpoint) File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/swift/trainers/mixin.py", line 261, in train return super().train(*args, **kwargs) File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/transformers/trainer.py", line 1885, in train return inner_training_loop( File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/transformers/trainer.py", line 2045, in _inner_training_loop model, self.optimizer, self.lr_scheduler = self.accelerator.prepare( File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/accelerate/accelerator.py", line 1445, in prepare result = self._prepare_deepspeed(*args) File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/accelerate/accelerator.py", line 2133, in _prepare_deepspeed engine, optimizer, _, lr_scheduler = ds_initialize(**kwargs) File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/deepspeed/__init__.py", line 181, in initialize engine = DeepSpeedEngine(args=args, File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 240, in __init__ self._do_sanity_check() File "/home/zhangmeixiang/anaconda3/envs/deepseek-vl2/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 1031, in _do_sanity_check raise ValueError("Type fp16 is not supported.") ValueError: Type fp16 is not supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions