JeffTheHacker / ContingenciesFromObservations

Other
34 stars 5 forks source link

KeyError: 'Custom_Dataset_json' #4

Closed SunHaoOne closed 2 years ago

SunHaoOne commented 2 years ago

Hello, thanks for your code and after generating the overtake datasets and convert to the json files about 200 episodes. I tried to run

 python $PRECOGROOT/precog/esp_train.py dataset=Custom_Dataset main.eager=False bijection.params.A=2 optimizer.params.plot_before_train=True optimizer.params.save_before_train=True

It shows as follow:

Config:
===
bijection:
  class: precog.bijection.social_convrnn.SocialConvRNN
  params:
    A: 2
    cnnconf:
      F: 8
      activation: relu
      append_cnn_input_to_cnn_output: false
      conv_filters: 32
      create_overhead_feature: false
      create_residual_connections: true
      do_batchnorm: false
      kernel_size: 3
      n_conv_layers: 6
    debug_eager: false
    debug_static: false
    lightconf:
      lightrep: 5
      postrnn_light_feats: true
      use_light_feats: true
    mlpconf:
      activation: tanh
      do_prernn_mlp: true
      mlp_units: 200
      n_postrnn_layers: 2
      n_prernn_layers: 2
    rnnconf:
      future_gru_units: 200
      past_do_preconv: true
      past_gru_units: 128
      past_perturb: false
      preconv_horizon: 3
      use_future_rnn: true
    socialconf:
      social_mlp_units: 200
      use_social_feats: true
      use_social_map_feats: false
    whiskerconf:
      arclength: 3.92699081699
      n_samples: 14
      radii:
      - 2
      - 4
      - 8
      use_whiskers: false
dataset:
  class: precog.dataset.serialized_dataset.SerializedDataset
  params:
    B: 10
    T: 30
    T_past: 15
    W: 200
    _max_A: 2
    _name: Custom_Dataset
    extra_params:
      allow_horizon_mismatch: false
      get_sdt_params:
        sdt_clip_thresh: 0.5
        sdt_params:
          clip_bottom: -3
          clip_top: 1
          normalize: true
        sdt_params_name: _clip0.5_stamp_neg3
        sdt_zero_h: 3
        sdt_zero_w: 8
        stamp: true
    feature_pixels_per_meter: 2.0
    fmt: json
    keyremap:
      agent_futures: A_future_world_frame
      agent_pasts: A_past_world_frame
      agent_yaws: A_yaws
      overhead_features: overhead_features
      player_future: S_future_world_frame
      player_past: S_past_world_frame
      player_yaw: yaws
    load_bev: true
    match_prefix: feed_*
    root_path: /home/shy/Desktop/ContingenciesFromObservations-main/Experiment/Custom_Dataset
    sdt_bev: false
    test_suffix: /test/
    train_suffix: /train/
    val_suffix: /val/
  plot_allchannel: false
distribution:
  params:
    K: 12
    logdet_method: manual
    name: foo
    sample_K: 12
hardware:
  allow_growth: true
  per_process_gpu_memory_fraction: 0.8
main:
  eager: false
  seed: 42
  tag: ''
objective:
  class: precog.objective.forward_kl.ForwardKL
  params:
    K_perturb: 12
optimizer:
  class: optimizer.sgd_optimizer.SGDOptimizer
  opt_method_choose_best: forward_KL
  params:
    debug: false
    epochs: 100000000000
    evaluate_period: 1000
    figsize:
    - 16
    - 40
    learning_rate: 0.0001
    plot_before_train: true
    plot_period: 1000
    plot_without_samples: false
    record_to_sheets: true
    save_before_train: true
    save_eager_figures: false
proxy:
  class: precog.distribution.empty_proxy.EmptyProxy
sample_metric:
  class: precog.sample_metric.minmsd.MHat

[2021-10-19 15:00:55,194][/home/shy/Desktop/ContingenciesFromObservations-main/precog/esp_train.py][INFO] - Output directory: /home/shy/Desktop/ContingenciesFromObservations-main/path_to/esp_train_results/2021-10/10-19-15-00-55_Custom_Dataset_precog.bijection.social_convrnn.SocialConvRNN_
[2021-10-19 15:00:55,194][/home/shy/Desktop/ContingenciesFromObservations-main/precog/esp_train.py][INFO] - Running in static mode
2021-10-19 15:00:55.195276: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2021-10-19 15:00:55.209819: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2021-10-19 15:00:55.463219: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55b1f02dea50 executing computations on platform CUDA. Devices:
2021-10-19 15:00:55.463369: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): GeForce RTX 2080, Compute Capability 7.5
2021-10-19 15:00:55.470566: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2099990000 Hz
2021-10-19 15:00:55.473797: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55b1f0414d40 executing computations on platform Host. Devices:
2021-10-19 15:00:55.473850: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2021-10-19 15:00:55.476414: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: GeForce RTX 2080 major: 7 minor: 5 memoryClockRate(GHz): 1.71
pciBusID: 0000:3b:00.0
2021-10-19 15:00:55.476634: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.476713: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.476778: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.476843: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.476907: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.476971: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.477036: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2021-10-19 15:00:55.477050: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
2021-10-19 15:00:55.477073: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-10-19 15:00:55.477085: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 
2021-10-19 15:00:55.477095: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N 
[2021-10-19 15:00:55,481][precog.bijection.social_convrnn][INFO] - Starting SocialConvRNN.__init__
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

[2021-10-19 15:00:56,032][tensorflow][WARNING] - 
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /home/shy/anaconda3/envs/precog/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py:121: GRUCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.GRUCell, and will be replaced by that in Tensorflow 2.0.
[2021-10-19 15:00:56,033][tensorflow][WARNING] - From /home/shy/anaconda3/envs/precog/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py:121: GRUCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.GRUCell, and will be replaced by that in Tensorflow 2.0.
[2021-10-19 15:00:56,041][precog.bijection.social_convrnn][INFO] - Finished SocialConvRNN.__init__ in 0.56s.
[2021-10-19 15:00:56,041][precog.distribution.bijective_distribution][INFO] - Starting ESPBijectiveDistribution.__init__
[2021-10-19 15:00:56,061][precog.distribution.bijective_distribution][INFO] - Finished ESPBijectiveDistribution.__init__ in 0.02s.
[2021-10-19 15:00:56,073][precog.dataset.serialized_dataset][INFO] - Starting SerializedDataset.__init__
[2021-10-19 15:00:56,767][precog.dataset.serialized_dataset][INFO] - Finished SerializedDataset.__init__ in 0.69s.
[2021-10-19 15:00:56,769][sgd_optimizer.py][INFO] - Beginning ESP Optimization.
        Distribution: ESPBijectiveDistribution(f=SocialConvRNN(), name=foo)
        Objective: ForwardKL()
        Dataset: SerializedDataset(root=/home/shy/Desktop/ContingenciesFromObservations-main/Experiment/Custom_Dataset)
        Data distribution proxy: EmptyProxy()
[2021-10-19 15:00:56,769][sgd_optimizer.py][INFO] - Fetching minibatch in order to create static-input placeholders
Traceback (most recent call last):
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/esp_train.py", line 124, in <module>
    if __name__ == '__main__': main()
  File "/home/shy/anaconda3/envs/precog/lib/python3.6/site-packages/hydra/main.py", line 24, in decorated_main
    strict=strict,
  File "/home/shy/anaconda3/envs/precog/lib/python3.6/site-packages/hydra/_internal/utils.py", line 174, in run_hydra
    overrides=args.overrides,
  File "/home/shy/anaconda3/envs/precog/lib/python3.6/site-packages/hydra/_internal/hydra.py", line 86, in run
    job_subdir_key=None,
  File "/home/shy/anaconda3/envs/precog/lib/python3.6/site-packages/hydra/plugins/common/utils.py", line 109, in run_job
    ret.return_value = task_function(task_cfg)
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/esp_train.py", line 23, in main
    def main(cfg): optimize(prepare_for_optimization(cfg))
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/esp_train.py", line 27, in optimize
    with tf.contrib.summary.always_record_summaries(): opt.optimize()
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/optimizer/sgd_optimizer.py", line 80, in optimize
    self._static_create_singleton()
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/optimizer/sgd_optimizer.py", line 156, in _static_create_singleton
    input_ = self.dataset.get_minibatch(split='train', mb_idx=0, is_training=True)
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/utils/log_util.py", line 48, in log_wrapper
    ret = wrapped_func(*args, **kwargs)
  File "/home/shy/Desktop/ContingenciesFromObservations-main/precog/dataset/serialized_dataset.py", line 151, in get_minibatch
    metadata_list = metadata_producers.PRODUCERS[self._name + '_' + self.fmt](data)
KeyError: 'Custom_Dataset_json'

***Should we remove "/home/shy/Desktop/ContingenciesFromObservations-main/path_to/esp_train_results/2021-10/10-19-15-00-55_Custom_Dataset_precog.bijection.social_convrnn.SocialConvRNN_"
(AKA: "10-19-15-00-55_Custom_Dataset_precog.bijection.social_convrnn.SocialConvRNN_") (y/n)***?n
[2021-10-19 15:38:10,056][/home/shy/Desktop/ContingenciesFromObservations-main/precog/utils/log_util.py][INFO] - Not removing '/home/shy/Desktop/ContingenciesFromObservations-main/path_to/esp_train_results/2021-10/10-19-15-00-55_Custom_Dataset_precog.bijection.social_convrnn.SocialConvRNN_'

I have no idea about how to fix the key errors and the data can be correctly loaded after I modified the relevant yaml files. And data can be seen as :

--EXperiment
----Custom_Dataset
------train
------test
------val

Thanks! Please tell me if I am wrong.

SunHaoOne commented 2 years ago

Finally, I tried to modified the serialized_dataset.py and add the Custom_Dataset_json : Left_Turn_Dataset_json_metadata_producer, and maybe it works well.