AlvinWen428 / FeatureCP

The official codebase for Predictive Inference with Feature Conformal Prediction
33 stars 9 forks source link

Runtime Error when running any of the commands #3

Closed Soothysay closed 11 months ago

Soothysay commented 1 year ago

Hi! I was trying to run your scripts by using the commands: python main.py --data fb1 --no-resume --seed 0 1 2 3 4 For the com data, I get the same error as well. The error is as given below:

File "/usr/WS1/soothy/FeatureCP/main.py", line 155, in <module>
    main(x_train, y_train, x_test, y_test, idx_train, idx_cal, args)
  File "/usr/WS1/soothy/FeatureCP/main.py", line 60, in main
    icp.calibrate(x_train[idx_cal, :], y_train[idx_cal])
  File "/usr/WS1/soothy/FeatureCP/conformal/icp.py", line 497, in calibrate
    cal_scores = self.nc_function.score(self.cal_x, self.cal_y)
  File "/usr/WS1/soothy/FeatureCP/conformal/icp.py", line 358, in score
    self.inv_step = self.find_best_step_num(x, y, z_pred)
  File "/usr/WS1/soothy/FeatureCP/conformal/icp.py", line 293, in find_best_step_num
    each_step_val_coverage, val_num = self.coverage_loose(x, y, z_pred, steps=max_inv_steps, val_significance=val_significance)
  File "/usr/WS1/soothy/FeatureCP/conformal/icp.py", line 260, in coverage_loose
    val_predictions = self.predict(x=val_x.detach().cpu().numpy(), nc=step_cal_score,
  File "/usr/WS1/soothy/FeatureCP/conformal/icp.py", line 440, in predict
    lb, ub = lirpa_model.compute_bounds(x=(my_input,), method=self.cmethod)  # (bs, 1), (bs, 1)
  File "/usr/workspace/soothy/anaconda/envs/opence-1.7.2-cuda-11.4/lib/python3.9/site-packages/auto_LiRPA/bound_general.py", line 1245, in compute_bounds
    self.ibp_lower, self.ibp_upper = self.IBP_general(node=final, C=C)
  File "/usr/workspace/soothy/anaconda/envs/opence-1.7.2-cuda-11.4/lib/python3.9/site-packages/auto_LiRPA/interval_bound.py", line 30, in IBP_general
    self.IBP_general(
  File "/usr/workspace/soothy/anaconda/envs/opence-1.7.2-cuda-11.4/lib/python3.9/site-packages/auto_LiRPA/interval_bound.py", line 42, in IBP_general
    node.interval = node.interval_propagate(*inp)
  File "/usr/workspace/soothy/anaconda/envs/opence-1.7.2-cuda-11.4/lib/python3.9/site-packages/auto_LiRPA/operators/dropout.py", line 65, in interval_propagate
    self._check_forward()
  File "/usr/workspace/soothy/anaconda/envs/opence-1.7.2-cuda-11.4/lib/python3.9/site-packages/auto_LiRPA/operators/dropout.py", line 36, in _check_forward
    raise RuntimeError('For a model with dropout in the training mode, '\
RuntimeError: For a model with dropout in the training mode, a clean forward pass must be called before bound computation

Could you help me debug what might be causing this problem?