-
Notifications
You must be signed in to change notification settings - Fork 98
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
TypeError: MoiraiMoEModule.__init__() missing 8 required positional arguments #144
Comments
Hi @Liuwenjing985, I think this is caused by using different versions of the code. I suggest you first get the latest code, and then reinstall the environment from source. Please do not use pip install uni2ts for now, we will update PyPI later. |
Hi,thank you for your answer,I have got the latest code today,and reinstall the virtual environment from source and did't use the "pip install uni2ts",but it still present the same error:TypeError: MoiraiMoEModule.__init__() missing 8 required positional arguments: 'distr_output', 'd_model', 'd_ff', 'num_layers', 'patch_sizes', 'max_seq_len', 'attn_dropout_p', and 'dropout_p', "It seems that when using module = MoiraiMoEModule.from_pretrained(f"Salesforce/moirai-moe-1.0-R-{SIZE}") to load the configuration file from Hugging Face, the parameters from the config.json file are not being correctly loaded. What should be done to resolve this?"
…------------------ 原始邮件 ------------------
发件人: "SalesforceAIResearch/uni2ts" ***@***.***>;
发送时间: 2024年11月14日(星期四) 晚上11:41
***@***.***>;
抄送: "a ***@***.******@***.***>;
主题: Re: [SalesforceAIResearch/uni2ts] TypeError: MoiraiMoEModule.__init__() missing 8 required positional arguments (Issue #144)
Hi @Liuwenjing985, I think this is caused by using different versions of the code. I suggest you first get the latest code, and then reinstall the environment from source. Please do not use pip install uni2ts for now, we will update PyPI later.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@Liuwenjing985 Thank you. I cannot reproduce your problem. Could you check if you can use Moirai instead of Moirai-MoE without any issues? |
Thank you !,I downloaded the MoE model weights and the config.json file from the Hugging Face website and read the weights from an absolute path.
’‘ elif MODEL == "moirai-moe": model = MoiraiMoEForecast( module=MoiraiMoEModule.from_pretrained(f"/root/autodl-tmp/uni2ts/src/moirai-moe-1.0-R-small"), prediction_length=PDT, context_length=CTX, patch_size=16, num_samples=100, target_dim=1, feat_dynamic_real_dim=ds.num_feat_dynamic_real, past_feat_dynamic_real_dim=ds.num_past_feat_dynamic_real, ) ‘’‘
Now it no longer reports the error 'TypeError: MoiraiMoEModule.init() missing 8 required positional arguments (Issue #144)', but the model still fails to load and reports a new error:
"
(moe) ***@***.***:~/autodl-tmp/uni2ts/src# python demo.py Loading weights from local directory Traceback (most recent call last): File "/root/autodl-tmp/uni2ts/src/demo.py", line 56, in <module> module=MoiraiMoEModule.from_pretrained(f"/root/autodl-tmp/uni2ts/src/moirai-moe-1.0-R-small"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/envs/moe/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/envs/moe/lib/python3.12/site-packages/huggingface_hub/hub_mixin.py", line 569, in from_pretrained instance = cls._from_pretrained( ^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/envs/moe/lib/python3.12/site-packages/huggingface_hub/hub_mixin.py", line 793, in _from_pretrained return cls._load_as_safetensor(model, model_file, map_location, strict) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/envs/moe/lib/python3.12/site-packages/huggingface_hub/hub_mixin.py", line 831, in _load_as_safetensor load_model_as_safetensor(model, model_file, strict=strict) # type: ignore [arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^ NameError: name 'load_model_as_safetensor' is not defined
I suspect that I downloaded the wrong version of Hugging Face. Could you please provide me with the requirements.txt file for this project?
…------------------ 原始邮件 ------------------
发件人: "SalesforceAIResearch/uni2ts" ***@***.***>;
发送时间: 2024年11月15日(星期五) 下午2:32
***@***.***>;
抄送: "a ***@***.******@***.***>;
主题: Re: [SalesforceAIResearch/uni2ts] TypeError: MoiraiMoEModule.__init__() missing 8 required positional arguments (Issue #144)
@Liuwenjing985 Thank you. I cannot reproduce your problem. Could you check if you can use Moirai instead of Moirai-MoE without any issues?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi @Liuwenjing985, the huggingface hub requirement is "huggingface_hub>=0.23.0". Please carefully follow the installation instruction in the README file: https://github.com/SalesforceAIResearch/uni2ts/blob/main/README.md, it should install correctly. You can also take a look on pyproject.toml for package requirements. |
Maybe you didn't correctly download the pretrain weight files caused by your network environment. You can try to download the pretrain weight file manually and replace the model path with your downloaded weight file path. |
Describe the bug
When I build a python demo name testmoe.py with the "get started codes example " in the src directory, the terminal gives the following error like this:
"TypeError: MoiraiMoEModule.init() missing 8 required positional arguments: 'distr_output', 'd_model', 'd_ff', 'num_layers', 'patch_sizes', 'max_seq_len', 'attn_dropout_p', and 'dropout_p' ", and I didn't pip install the uni2ts in the virtual environment.
Expected behavior
pleease help me to anasys the problem
Environment
The text was updated successfully, but these errors were encountered: