Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daidaiershidi opened this issue Sep 26, 2024 · 0 comments

Comments

@daidaiershidi
Copy link

daidaiershidi commented Sep 26, 2024

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. 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant