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

Fix/evaluate no grad #201

Merged
merged 5 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sheeprl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Any, Dict

import hydra
import torch
from lightning import Fabric
from lightning.fabric.strategies import STRATEGY_REGISTRY, DDPStrategy, SingleDeviceStrategy, Strategy
from omegaconf import DictConfig, OmegaConf, open_dict
Expand Down Expand Up @@ -209,6 +210,8 @@ def eval_algorithm(cfg: DictConfig):
)
task = importlib.import_module(f"{module}.{evaluation_file}")
command = task.__dict__[entrypoint]
if getattr(cfg, "disable_grads", True):
command = torch.no_grad(command)
fabric.launch(command, cfg, state)


Expand Down
1 change: 1 addition & 0 deletions sheeprl/configs/eval_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ fabric:
env:
capture_video: True

disable_grads: True
checkpoint_path: ???
Loading