Skip to content

Commit

Permalink
fix indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhenaff committed Jun 12, 2019
1 parent 1d2c6e0 commit 490c85c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ def get_batch_fm(self, split, npred=-1, cuda=True):
costs.append(self.costs[s][t:t+(self.opt.ncond+npred)+1].cuda())
ids.append(self.ids[s])
splits = self.ids[s].split('/')
timeslot = splits[4]
car_id = int(re.findall('car(\d+).pkl', splits[5])[0])
# timeslot = splits[4]
timeslot = splits[3]
car_id = int(re.findall('car(\d+).pkl', splits[4])[0])
# car_id = int(re.findall('car(\d+).pkl', splits[5])[0])
size = self.car_sizes[timeslot][car_id]
sizes.append([size[0], size[1]])
nb += 1
Expand Down

1 comment on commit 490c85c

@Atcold
Copy link
Owner

@Atcold Atcold commented on 490c85c Jul 14, 2019

Choose a reason for hiding this comment

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

Hmm, now it breaks for me...

Traceback (most recent call last):ges: 0.0%]
  File "train_MPUR.py", line 144, in <module>
    planning.estimate_uncertainty_stats(model, dataloader, n_batches=50, npred=opt.npred)
  File "/home/atcold/Work/GitHub/pytorch-Traffic-Simulator/planning.py", line 129, in estimate_uncertainty_stats
    inputs, actions, targets, ids, car_sizes = dataloader.get_batch_fm('train', npred)
  File "/home/atcold/Work/GitHub/pytorch-Traffic-Simulator/dataloader.py", line 164, in get_batch_fm
    car_id = int(re.findall('car(\d+).pkl', splits[4])[0])
IndexError: list index out of range

I'm wondering what's going on.

Please sign in to comment.