Unverified Commit 65ea1904 authored by Pashmina Cameron's avatar Pashmina Cameron Committed by GitHub
Browse files

PEFT: Access active_adapters as a property in Trainer (#30790)

Access active_adapters as a property
parent c02d302e
...@@ -2533,7 +2533,7 @@ class Trainer: ...@@ -2533,7 +2533,7 @@ class Trainer:
if os.path.exists(resume_from_checkpoint): if os.path.exists(resume_from_checkpoint):
# For BC for older PEFT versions # For BC for older PEFT versions
if hasattr(model, "active_adapters"): if hasattr(model, "active_adapters"):
active_adapters = model.active_adapters() active_adapters = model.active_adapters
if len(active_adapters) > 1: if len(active_adapters) > 1:
logger.warning("Multiple active adapters detected will only consider the first adapter") logger.warning("Multiple active adapters detected will only consider the first adapter")
active_adapter = active_adapters[0] active_adapter = active_adapters[0]
...@@ -2626,8 +2626,8 @@ class Trainer: ...@@ -2626,8 +2626,8 @@ class Trainer:
): ):
# For BC for older PEFT versions # For BC for older PEFT versions
if hasattr(model, "active_adapters"): if hasattr(model, "active_adapters"):
active_adapter = model.active_adapters()[0] active_adapter = model.active_adapters[0]
if len(model.active_adapters()) > 1: if len(model.active_adapters) > 1:
logger.warning("Detected multiple active adapters, will only consider the first one") logger.warning("Detected multiple active adapters, will only consider the first one")
else: else:
active_adapter = model.active_adapter active_adapter = model.active_adapter
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment