Added missing super().__init__() in RWKV6State

#5
by jirka642 - opened

This fixes error that happened when trying to load model on multiple devices in text-generation-webui.

text-generation-webui  | Traceback (most recent call last):
text-generation-webui  |   File "/app/modules/callbacks.py", line 61, in gentask
text-generation-webui  |     ret = self.mfunc(callback=_callback, *args, **self.kwargs)
text-generation-webui  |   File "/app/modules/text_generation.py", line 398, in generate_with_callback
text-generation-webui  |     shared.model.generate(**kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
text-generation-webui  |     return func(*args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/transformers/generation/utils.py", line 2215, in generate
text-generation-webui  |     result = self._sample(
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/transformers/generation/utils.py", line 3206, in _sample
text-generation-webui  |     outputs = self(**model_inputs, return_dict=True)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
text-generation-webui  |     return self._call_impl(*args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
text-generation-webui  |     return forward_call(*args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/accelerate/hooks.py", line 170, in new_forward
text-generation-webui  |     output = module._old_forward(*args, **kwargs)
text-generation-webui  |   File "/root/.cache/huggingface/modules/transformers_modules/recursal_QRWKV6-32B-Instruct-Preview-v0.1/modeling_rwkv6qwen2.py", line 756, in forward
text-generation-webui  |     outputs = self.model(
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
text-generation-webui  |     return self._call_impl(*args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
text-generation-webui  |     return forward_call(*args, **kwargs)
text-generation-webui  |   File "/root/.cache/huggingface/modules/transformers_modules/recursal_QRWKV6-32B-Instruct-Preview-v0.1/modeling_rwkv6qwen2.py", line 632, in forward
text-generation-webui  |     layer_outputs = decoder_layer(
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
text-generation-webui  |     return self._call_impl(*args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
text-generation-webui  |     return forward_call(*args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/accelerate/hooks.py", line 165, in new_forward
text-generation-webui  |     args, kwargs = module._hf_hook.pre_forward(module, *args, **kwargs)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/accelerate/hooks.py", line 364, in pre_forward
text-generation-webui  |     return send_to_device(args, self.execution_device), send_to_device(
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 184, in send_to_device
text-generation-webui  |     {
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 185, in <dictcomp>
text-generation-webui  |     k: t if k in skip_keys else send_to_device(t, device, non_blocking=non_blocking, skip_keys=skip_keys)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/accelerate/utils/operations.py", line 156, in send_to_device
text-generation-webui  |     return tensor.to(device, non_blocking=non_blocking)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1174, in to
text-generation-webui  |     return self._apply(convert)
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 779, in _apply
text-generation-webui  |     for module in self.children():
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2345, in children
text-generation-webui  |     for name, module in self.named_children():
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2363, in named_children
text-generation-webui  |     for name, module in self._modules.items():
text-generation-webui  |   File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1729, in __getattr__
text-generation-webui  |     raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
text-generation-webui  | AttributeError: 'RWKV6State' object has no attribute '_modules'
recursal org

Thank you for the bugfix!

SmerkyG changed pull request status to merged

Sign up or log in to comment