Fix loop var naming (#38885)
Some checks are pending
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Waiting to run
Build documentation / build (push) Waiting to run
New model PR merged notification / Notify new model (push) Waiting to run
Slow tests on important models (on Push - A10) / Get all modified files (push) Waiting to run
Slow tests on important models (on Push - A10) / Slow & FA2 tests (push) Blocked by required conditions
Self-hosted runner (push-caller) / Check if setup was changed (push) Waiting to run
Self-hosted runner (push-caller) / build-docker-containers (push) Blocked by required conditions
Self-hosted runner (push-caller) / Trigger Push CI (push) Blocked by required conditions
Secret Leaks / trufflehog (push) Waiting to run
Update Transformers metadata / build_and_package (push) Waiting to run

This commit is contained in:
Matt 2025-06-18 14:45:01 +01:00 committed by GitHub
parent 1fc67a25c6
commit 9cd7570f34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -380,10 +380,10 @@ def get_parameter_dtype(parameter: Union[nn.Module, "ModuleUtilsMixin"]):
gen = parameter._named_members(get_members_fn=find_tensor_attributes) gen = parameter._named_members(get_members_fn=find_tensor_attributes)
last_tuple = None last_tuple = None
for tuple in gen: for gen_tuple in gen:
last_tuple = tuple last_tuple = gen_tuple
if tuple[1].is_floating_point(): if gen_tuple[1].is_floating_point():
return tuple[1].dtype return gen_tuple[1].dtype
if last_tuple is not None: if last_tuple is not None:
# fallback to the last dtype # fallback to the last dtype