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

Update: brain file to use gpu #371

Merged
merged 4 commits into from Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions behavior_metrics/brains/f1/brain_f1_torch.py
Expand Up @@ -43,8 +43,8 @@ def __init__(self, sensors, actuators, model=None, handler=None, config=None):
self.handler = handler
self.cont = 0
self.inference_times = []
self.device = torch.device("cpu")
self.gpu_inference = torch.cuda.is_available()
self.gpu_inference = config['GPU']
self.device = torch.device('cuda' if (torch.cuda.is_available() and self.gpu_inference) else 'cpu')
self.first_image = None
self.transformations = transforms.Compose([
transforms.ToTensor()
Expand Down Expand Up @@ -110,7 +110,7 @@ def execute(self):
with torch.no_grad():
image = self.transformations(img).unsqueeze(0)
image = FLOAT(image).to(self.device)
prediction = self.net(image).numpy()
prediction = self.net(image).cpu().numpy()
sergiopaniego marked this conversation as resolved.
Show resolved Hide resolved
self.inference_times.append(time.time() - start_time)
sergiopaniego marked this conversation as resolved.
Show resolved Hide resolved
# prediction_v = prediction[0][0]*6.5
prediction_v = prediction[0][0]
Expand Down
1 change: 1 addition & 0 deletions behavior_metrics/configs/DL-torch.yml
Expand Up @@ -21,6 +21,7 @@ Behaviors:
Parameters:
Model: 'model_pilotnet_torch_extreme.ckpt'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model listed here in the official repo is from last year and the predictions are not normalized. Are you using a new version that is different from that one?
You should upload that version here two if so, please.

ImageCrop: True
GPU: True
Type: 'f1'
Experiment:
Name: "Experiment name"
Expand Down