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

what is the version of python #17

Open
learn01one opened this issue Feb 4, 2024 · 10 comments
Open

what is the version of python #17

learn01one opened this issue Feb 4, 2024 · 10 comments

Comments

@learn01one
Copy link

hello,can i ask the version of the python,i met the problem like ValueError: mutable default <class 'trainer.accelerators.base_accelerator.DebugConfig'> for field debug is not allowed: use
default_factory

@yuvalkirstain
Copy link
Owner

Seems like the issue is hydra version. I'm not which version it was, but try to use an older one.

@learn01one
Copy link
Author

hello,The code running environment is torch=2.2.0,python=3.11,Others are installed provided versions,Many similar questions arise,like ,ValueError: mutable default <class 'trainer.configs.configs.DebugConfig'> for field debug is not allowed: use default_factory,and ValueError: mutable default <class 'trainer.accelerators.deepspeed_accelerator.DeepSpeedConfig'> for field deepspeed is not allowed: use default_factory

It should be an environmental problem. Can you provide a more detailed operating environment? Thanks.

@yuvalkirstain
Copy link
Owner

I was running with python 3.8

@yuvalkirstain
Copy link
Owner

I don't have access to the env I ran with at the moment. If you continue to have this issue I'll help you debug it.

@learn01one
Copy link
Author

hello,All the problems before using python=3.8 have been solved. The training seems to be almost successful, just encountered a small problem.,like

fp16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=True)
│ 23 │ bf16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False)
│ 24 │ optimizer: dict = field(default_factory=lambda: {
│ 25 │ │ "type": "AdamW",
TypeError: MixedPrecisionConfig() takes no arguments

Are there any additional parameters required during operation?thanks

@yuvalkirstain
Copy link
Owner

yuvalkirstain commented Feb 4, 2024

Can you please show here the entire error trace? Also, what cmd you are running.

@learn01one
Copy link
Author

ok,running it by:
accelerate launch --dynamo_backend no --gpu_ids all --num_processes 8 --num_machines 1 --use_deepspeed trainer/scripts/train.py +experiment=clip_h output_dir=output

the entire error trace like:
────────────────────────────────╮
│ /PickScore/trainer/scripts/train.py:13 in │
│ │
│ 10 from torch import nn │
│ 11 import sys │
│ 12 │
│ ❱ 13 from trainer.accelerators.base_accelerator import BaseAccelerator │
│ 14 from trainer.configs.configs import TrainerConfig, instantiate_with_cfg │
│ 15 │
│ 16 import pdb │
│ │
│ /PickScore/trainer/accelerators/init.py:4 in │
│ │
│ 1 from hydra.core.config_store import ConfigStore │
│ 2 │
│ 3 from trainer.accelerators.debug_accelerator import DebugAcceleratorConfig │
│ ❱ 4 from trainer.accelerators.deepspeed_accelerator import DeepSpeedAcceleratorConfig │
│ 5 │
│ 6 ACCELERATOR_GROUP_NAME = "accelerator" │
│ 7 │
│ │
│ /PickScore/trainer/accelerators/deepspeed_accelerator.py:20 in │
│ │
│ │
│ 17 │
│ 18 │
│ 19 @DataClass
│ ❱ 20 class DeepSpeedConfig: │
│ 21 │ #pdb.set_trace() │
│ 22 │ fp16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=True) │
│ 23 │ bf16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False) │
│ │
│ /PickScore/trainer/accelerators/deepspeed_accelerator.py:22 in │
│ DeepSpeedConfig │
│ │
│ 19 @DataClass
│ 20 class DeepSpeedConfig: │
│ 21 │ #pdb.set_trace() │
│ ❱ 22 │ fp16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=True) │
│ 23 │ bf16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False) │
│ 24 │ optimizer: dict = field(default_factory=lambda: { │
│ 25 │ │ "type": "AdamW", │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: MixedPrecisionConfig() takes no arguments

@yuvalkirstain
Copy link
Owner

Really strange.. I am able to run this code with no problem:

>>> from omegaconf import OmegaConf, MISSING, II
>>>
>>> from dataclasses import dataclass, field
>>>
>>> @dataclass
... class MixedPrecisionConfig:
...     enabled: bool = MISSING
...
>>> @dataclass
... class DeepSpeedConfig:
...     fp16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False)
...     bf16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False)
...
>>>

With Python 3.10.13. Perhaps try to use 3.10?

@learn01one
Copy link
Author

hell0,Using python=3.10, the same problem still occurs. Can you show your deepspeed default_config.yaml?thanks

@yuvalkirstain
Copy link
Owner

what does the deepspeed config has to do with it?
Can you locally run the code that fails?

from omegaconf import OmegaConf, MISSING, II
from dataclasses import dataclass, field

@dataclass
class MixedPrecisionConfig:
    enabled: bool = MISSING

@dataclass
class DeepSpeedConfig:
    fp16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False)
    bf16: MixedPrecisionConfig = MixedPrecisionConfig(enabled=False)

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

2 participants