AI-Guru / helibrunna

A HuggingFace compatible Small Language Model trainer.
GNU Affero General Public License v3.0
73 stars 7 forks source link

Error "too many values to unpack (expected 2)" #2

Closed kroll-software closed 3 months ago

kroll-software commented 3 months ago

in train.py, line 227 outputs = model(inputs.to(device=accelerator.device))

Thanks,

AI-Guru commented 3 months ago

Interesting! Please submit steps how to reproduce that error.

kroll-software commented 3 months ago

Hello,

I'm running on Ubuntu 24.04 with cuda

[image: image.png]

Terminal output:

Output directory: output/musicxlstm/run_20240821-1543 Loading preprocessed data... Creating model... {'verbose': True, 'with_cuda': True, 'extra_ldflags': ['-L/usr/local/cuda/lib', '-lcublas'], 'extra_cflags': ['-DSLSTM_HIDDEN_SIZE=64', '-DSLSTM_BATCH_SIZE=8', '-DSLSTM_NUM_HEADS=1', '-DSLSTM_NUM_STATES=4', '-DSLSTM_DTYPE_B=float', '-DSLSTM_DTYPE_R=nv_bfloat16', '-DSLSTM_DTYPE_W=__nv_bfloat16', '-DSLSTM_DTYPE_G=nv_bfloat16', '-DSLSTM_DTYPE_S=nv_bfloat16', '-DSLSTM_DTYPE_A=float', '-DSLSTM_NUM_GATES=4', '-DSLSTM_SIMPLE_AGG=true', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL_VALID=false', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL=0.0', '-DSLSTM_FORWARD_CLIPVAL_VALID=false', '-DSLSTM_FORWARD_CLIPVAL=0.0', '-U__CUDA_NO_HALF_OPERATORS', '-UCUDA_NO_HALF_CONVERSIONS', '-UCUDA_NO_BFLOAT16_OPERATORS', '-UCUDA_NO_BFLOAT16_CONVERSIONS', '-UCUDA_NO_BFLOAT162_OPERATORS', '-UCUDA_NO_BFLOAT162_CONVERSIONS'], 'extra_cuda_cflags': ['-Xptxas="-v"', '-gencode', 'arch=compute_80,code=compute_80', '-res-usage', '--use_fast_math', '-O3', '-Xptxas -O3', '--extra-device-vectorization', '-DSLSTM_HIDDEN_SIZE=64', '-DSLSTM_BATCH_SIZE=8', '-DSLSTM_NUM_HEADS=1', '-DSLSTM_NUM_STATES=4', '-DSLSTM_DTYPE_B=float', '-DSLSTM_DTYPE_R=nv_bfloat16', '-DSLSTM_DTYPE_W=nv_bfloat16', '-DSLSTM_DTYPE_G=nv_bfloat16', '-DSLSTM_DTYPE_S=__nv_bfloat16', '-DSLSTM_DTYPE_A=float', '-DSLSTM_NUM_GATES=4', '-DSLSTM_SIMPLE_AGG=true', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL_VALID=false', '-DSLSTM_GRADIENT_RECURRENT_CLIPVAL=0.0', '-DSLSTM_FORWARD_CLIPVAL_VALID=false', '-DSLSTM_FORWARD_CLIPVAL=0.0', '-UCUDA_NO_HALF_OPERATORS', '-UCUDA_NO_HALF_CONVERSIONS', '-UCUDA_NO_BFLOAT16_OPERATORS', '-UCUDA_NO_BFLOAT16_CONVERSIONS', '-UCUDA_NO_BFLOAT162_OPERATORS', '-UCUDA_NO_BFLOAT162_CONVERSIONS__']} Using /home/detlef/.cache/torch_extensions/py310_cu121 as PyTorch extensions root... Detected CUDA files, patching ldflags Emitting ninja build file /home/detlef/.cache/torch_extensions/py310_cu121/slstm_HS64BS8NH1NS4DBfDRbDWbDGbDSbDAfNG4SA1GRCV0GRC0d0FCV0FC0d0/build.ninja... /home/detlef/miniconda3/lib/python3.10/site-packages/torch/utils/cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation. If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST']. warnings.warn( Building extension module slstm_HS64BS8NH1NS4DBfDRbDWbDGbDSbDAfNG4SA1GRCV0GRC0d0FCV0FC0d0... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) ninja: no work to do. Loading extension module slstm_HS64BS8NH1NS4DBfDRbDWbDGbDSbDAfNG4SA1GRCV0GRC0d0FCV0FC0d0... /home/detlef/miniconda3/lib/python3.10/site-packages/xlstm/blocks/slstm/cell.py:546: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead. def forward(ctx, training, *inputs): /home/detlef/miniconda3/lib/python3.10/site-packages/xlstm/blocks/slstm/cell.py:571: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_s): Training dtype: torch.float32 xLSTMLMModel( (xlstm_block_stack): xLSTMBlockStack( (blocks): ModuleList( (0): mLSTMBlock( (xlstm_norm): LayerNorm() (xlstm): mLSTMLayer( (proj_up): Linear(in_features=64, out_features=256, bias=False) (q_proj): LinearHeadwiseExpand(in_features=128, num_heads=32, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (k_proj): LinearHeadwiseExpand(in_features=128, num_heads=32, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (v_proj): LinearHeadwiseExpand(in_features=128, num_heads=32, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (conv1d): CausalConv1d( (conv): Conv1d(128, 128, kernel_size=(4,), stride=(1,), padding=(3,), groups=128) ) (conv_act_fn): SiLU() (mlstm_cell): mLSTMCell( (igate): Linear(in_features=384, out_features=1, bias=True) (fgate): Linear(in_features=384, out_features=1, bias=True) (outnorm): MultiHeadLayerNorm() ) (ogate_act_fn): SiLU() (proj_down): Linear(in_features=128, out_features=64, bias=False) (dropout): Dropout(p=0.0, inplace=False) ) ) (1): sLSTMBlock( (xlstm_norm): LayerNorm() (xlstm): sLSTMLayer( (conv1d): CausalConv1d( (conv): Conv1d(64, 64, kernel_size=(4,), stride=(1,), padding=(3,), groups=64) ) (conv_act_fn): SiLU() (fgate): LinearHeadwiseExpand(in_features=64, num_heads=1, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (igate): LinearHeadwiseExpand(in_features=64, num_heads=1, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (zgate): LinearHeadwiseExpand(in_features=64, num_heads=1, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (ogate): LinearHeadwiseExpand(in_features=64, num_heads=1, expand_factor_up=1, bias=False, trainable_weight=True, trainable_bias=True, ) (slstm_cell): sLSTMCell_cuda(function=slstm, hidden_size=64, num_heads=1) (group_norm): MultiHeadLayerNorm() (dropout): Dropout(p=0.0, inplace=False) ) (ffn_norm): LayerNorm() (ffn): GatedFeedForward( (proj_up): Linear(in_features=64, out_features=256, bias=False) (proj_down): Linear(in_features=128, out_features=64, bias=False) (dropout): Dropout(p=0.0, inplace=False) ) ) ) (post_blocks_norm): LayerNorm() ) (token_embedding): Embedding(119, 64) (emb_dropout): Identity() (lm_head): Linear(in_features=64, out_features=119, bias=False) ) Number of parameters: 101_250 (101.2K) Preparing DataLoader... Estimated number of steps: 313 Enabling wandb logging for project: musicxlstm /home/detlef/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/_vendored/force_pydevd.py:18: UserWarning: incompatible copy of pydevd already imported: /home/detlef/.local/lib/python3.10/site-packages/pydevd_plugins/extensions/pydevd_plugin_omegaconf.py warnings.warn(msg + ':\n {}'.format('\n '.join(_unvendored))) wandb: (1) Create a W&B account wandb: (2) Use an existing W&B account wandb: (3) Don't visualize my results wandb: Enter your choice: 3 wandb: You chose "Don't visualize my results" wandb: Tracking run with wandb version 0.17.7 wandb: W&B syncing is set to offline in this directory. wandb: Run wandb online or set WANDB_MODE=online to enable cloud syncing. Training: 0%| | 0/313 [00:00<?, ?step/s]Backend TkAgg is interactive backend. Turning interactive mode on.


Here the error occurs.

Hope it helps,

Detlef

Am Mi., 21. Aug. 2024 um 13:58 Uhr schrieb Dr. Tristan Behrens < @.***>:

Interesting! Please submit steps how to provike that error.

— Reply to this email directly, view it on GitHub https://github.com/AI-Guru/helibrunna/issues/2#issuecomment-2301875375, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3Q2BYCJM77UKQPSI5EOQLZSR6GVAVCNFSM6AAAAABM33BY42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRHA3TKMZXGU . You are receiving this because you authored the thread.Message ID: @.***>

--


Detlef Kroll Software-Entwicklung Höfligasse 11 CH - 6460 Altdorf / URI Phone: +41-41-5351767 Email: @.*** http://www.kroll-software.ch

kroll-software commented 3 months ago

Here's another screenshot, showing the contents of inputs.to(device=accelerator.device)[0]

inputs.to(device=accelerator.device) has the length 256 inputs.to(device=accelerator.device)[0] has the length 256

[image: image.png]

Please let me know when you need any more infos,

Detlef

--


Detlef Kroll Software-Entwicklung Höfligasse 11 CH - 6460 Altdorf / URI Phone: +41-41-5351767 Email: @.*** http://www.kroll-software.ch

kroll-software commented 3 months ago

I'm using config_path = "./configs/musicxlstm.yaml"

The tokenizers were missing, so I downloaded

tokenizer.json tokenizer_config.json special_tokens_map.json

from https://huggingface.co/TristanBehrens/musicxlstm

to the project root directory.

Maybe I'm using the wrong tokenizers?

Cheers,

--


Detlef Kroll Software-Entwicklung Höfligasse 11 CH - 6460 Altdorf / URI Phone: +41-41-5351767 Email: @.*** http://www.kroll-software.ch

AI-Guru commented 3 months ago

How did you start the script?

Did you create an xLSTM conda environment as per the installation instructions? Did you install the requirements from requirements.txt?

kroll-software commented 3 months ago

How did you start the script?

from within vs-code.

Did you create an xLSTM conda environment as per the installation instructions? Did you install the requirements from requirements.txt?

yes.

AI-Guru commented 3 months ago

I checked. Good find! I fixed a bug and pushed the changes! Let me know if it works.

kroll-software commented 3 months ago

After making a fresh install with the full conda-environment from the xLSTM repository, it works :)

Thanks, Detlef

AI-Guru commented 3 months ago

@kroll-software thanks! Great! You are the best! I will close this issue now.