safe-control-gym: Re-create Figure 6 in "Safe Learning in Robotics" errors
Hey Jacopo,
Thanks for the great review paper and open sourcing the accompanying codes here.
I would like to reproduce Figure 6 by following commands but got error messages after successfully loading five GP models as
#########################################
# Loading GP dimension 5 #
#########################################
Path: ./trained_gp_model/best_model_5.pth
Loaded!
Traceback (most recent call last):
File "./gp_mpc_experiment.py", line 179, in <module>
ctrl.learn()
File "/home/jwang/Control_ws/src/safe-control-gym/safe_control_gym/controllers/mpc/gp_mpc.py", line 809, in learn
self.reset()
File "/home/jwang/Control_ws/src/safe-control-gym/safe_control_gym/controllers/mpc/gp_mpc.py", line 899, in reset
self.setup_gp_optimizer(n_ind_points)
File "/home/jwang/Control_ws/src/safe-control-gym/safe_control_gym/controllers/mpc/gp_mpc.py", line 562, in setup_gp_optimizer
mean_post_factor_val, Sigma, K_zind_zind_inv, z_ind_val = self.precompute_sparse_gp_values(n_ind_points)
File "/home/jwang/Control_ws/src/safe-control-gym/safe_control_gym/controllers/mpc/gp_mpc.py", line 394, in precompute_sparse_gp_values
inds, dist_mat = pairwise_distances_argmin_min(centroids, inputs[:, self.input_mask])
File "/home/jwang/anaconda3/envs/safe/lib/python3.8/site-packages/sklearn/metrics/pairwise.py", line 680, in pairwise_distances_argmin_min
values, indices = PairwiseDistancesArgKmin.compute(
File "sklearn/metrics/_pairwise_distances_reduction.pyx", line 672, in sklearn.metrics._pairwise_distances_reduction.PairwiseDistancesArgKmin.compute
File "sklearn/metrics/_pairwise_distances_reduction.pyx", line 1055, in sklearn.metrics._pairwise_distances_reduction.FastEuclideanPairwiseDistancesArgKmin.__init__
File "sklearn/metrics/_dist_metrics.pyx", line 1300, in sklearn.metrics._dist_metrics.DatasetsPair.get_for
File "sklearn/metrics/_dist_metrics.pyx", line 1349, in sklearn.metrics._dist_metrics.DenseDenseDatasetsPair.__init__
File "stringsource", line 658, in View.MemoryView.memoryview_cwrapper
File "stringsource", line 349, in View.MemoryView.memoryview.__cinit__
ValueError: ndarray is not C-contiguous
I wonder if you could help with this? Thank you.
Regards, Jie
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (10 by maintainers)
https://arxiv.org/abs/2109.06325 (it is now officially an IROS/RA-L paper)
@adamhall The plot looks pretty much the same as this one with both the existing and retrained models.
@JacopoPan Sure, I will first look into seeing what the changes were in the newer version of
scikit-learnand if we can change this function.Glad it’s working for you. Just for our debugging and to be clear, do the plots look reasonable when you run it with both the existing models and the retrained models?
The issue isn’t actually in the loading or the training of the models. The function in question is used when selecting inducing points for the GP to keep the size of the GP smaller but still yield reasonable predictions.
@adamhall I re-installed
scikit-learn==1.0.2incondaand it works. Thanks for the quick help! @JacopoPan I retrained the models, but the existing modes also didn’t work. I work onubuntu 20.04.4. I believe the issue is due toscikit-learnversion.Thanks again for the responsive help, I appreciate it!