mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-23 09:46:00 +00:00
Make it possible to use PeftModels in eval
This commit is contained in:
@@ -277,9 +277,17 @@ def eval_policy(
|
|||||||
raise ValueError("If max_episodes_rendered > 0, videos_dir must be provided.")
|
raise ValueError("If max_episodes_rendered > 0, videos_dir must be provided.")
|
||||||
|
|
||||||
if not isinstance(policy, PreTrainedPolicy):
|
if not isinstance(policy, PreTrainedPolicy):
|
||||||
raise ValueError(
|
exc = ValueError(
|
||||||
f"Policy of type 'PreTrainedPolicy' is expected, but type '{type(policy)}' was provided."
|
f"Policy of type 'PreTrainedPolicy' is expected, but type '{type(policy)}' was provided."
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
from peft import PeftModel
|
||||||
|
|
||||||
|
if not isinstance(policy, PeftModel):
|
||||||
|
raise exc
|
||||||
|
except ImportError:
|
||||||
|
raise exc
|
||||||
|
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
policy.eval()
|
policy.eval()
|
||||||
|
|||||||
Reference in New Issue
Block a user