ValueError: `params` cannot be accessed from model when the model is created with `_do_init=False`.
jchauhan opened this issue · 2 comments
jchauhan commented
Describe the bug
Getting the following error while running llama model after training using EasyDel and converting to Hugging face.
python serve_llama_tpu_easydel.py
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:03<00:00, 1.14s/it]
Traceback (most recent call last):
File "/home/XXX/research/EasyDeL/serve_llama_tpu_easydel.py", line 26, in <module>
params=model.params,
File "/home/XXX/research/EasyDeL/.venv/lib/python3.10/site-packages/transformers/modeling_flax_utils.py", line 271, in params
raise ValueError(
ValueError: `params` cannot be accessed from model when the model is created with `_do_init=False`. You must call `init_weights` manually and store the params outside of the model and pass it explicitly where needed.
To Reproduce
- Using Kaggle to traiin llama-2-7b-chat-hf model on certain data
- convert and publish to Hugging face
- load the model using EasyDel example
jchauhan commented
Possible Solution,
Take _do_init as parameter. currently it is hardcoded
lib/python/EasyDel/modules/auto_easydel_model.py
ed_model = module(
config=cfg,
_do_init=False,
dtype=dtype,
param_dtype=param_dtype,
precision=precision,
input_shape=input_shape
)
Is there any other better solution while publishing model to avoid the error?
erfanzar commented
you don't need to re-init parameters in case of converting or serving or even training this is happing cause you not using library correctly can I have access to your code