stanford_alpaca icon indicating copy to clipboard operation
stanford_alpaca copied to clipboard

ValueError: Trying to set a tensor of shape torch.Size([32769536]) in "weight" (which has shape torch.Size([32001, 4096])), this looks incorrect.

Open daidaiershidi opened this issue 1 year ago • 3 comments

When I finetune llama7b:

# alpaca
torchrun --nproc_per_node=8 --master_port=29000 train.py \
    --model_name_or_path .cache/hub/models--meta-llama--Llama-2-7b-hf/snapshots/01c7f73d771dfac7d292323805ebc428287df4f9 \
    --data_path ./alpaca_data.json \
    --bf16 True \
    --output_dir output/Llama-2-7b-hf \
    --num_train_epochs 3 \
    --per_device_train_batch_size 2 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 8 \
    --evaluation_strategy "no" \
    --save_strategy "epoch" \
    --save_steps 2000 \
    --save_total_limit 1 \
    --learning_rate 2e-5 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --fsdp "full_shard auto_wrap" \
    --fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
    --tf32 True \
    --model_max_length 512 ;

then load by transformers:

 ValueError: Trying to set a tensor of shape torch.Size([32769536]) in "weight" (which has shape torch.Size([32001, 4096])), this looks incorrect. 

daidaiershidi avatar Sep 26 '24 03:09 daidaiershidi