mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-03 03:31:05 +06:00
Update training_args.py to remove the runtime error (#25920)
This cl iterates through a list of keys rather than dict items while updating the dict elements. Fixes the following error: File "..../transformers/training_args.py", line 1544, in post_init for k, v in self.fsdp_config.items(): RuntimeError: dictionary keys changed during iteration
This commit is contained in:
parent
7011cd8667
commit
aea761499f
@ -1546,10 +1546,10 @@ class TrainingArguments:
|
||||
warnings.warn("`--fsdp_config` is useful only when `--fsdp` is specified.")
|
||||
with io.open(self.fsdp_config, "r", encoding="utf-8") as f:
|
||||
self.fsdp_config = json.load(f)
|
||||
for k, v in self.fsdp_config.items():
|
||||
for k in list(self.fsdp_config.keys()):
|
||||
if k.startswith("fsdp_"):
|
||||
self.fsdp_config[k.replace("fsdp_", "")] = v
|
||||
del self.fsdp_config[k]
|
||||
v = self.fsdp_config.pop(k)
|
||||
self.fsdp_config[k[5:]] = v
|
||||
|
||||
if self.fsdp_min_num_params > 0:
|
||||
warnings.warn("using `--fsdp_min_num_params` is deprecated. Use fsdp_config instead ", FutureWarning)
|
||||
|
Loading…
Reference in New Issue
Block a user