liujl11git / GNN-MILP

[ICLR 2023] "On Representing Mixed-Integer Linear Programs by Graph Neural Networks" by Ziang Chen, Jialin Liu, Xinshang Wang, Jianfeng Lu, Wotao Yin.
MIT License
28 stars 9 forks source link

ValueError: Sequential model sequential_1 cannot be built because it has no layers. Call `model.add(layer)`. #2

Open cszmzh opened 4 months ago

cszmzh commented 4 months ago

/mnt/nfs/miniconda3/envs/dl-opt/bin/python3 /mnt/work/dl-opt/GNN-MILP-main/2_training.py --type fea --data 1000 --data_path data-env2/training --embSize 8 2024-03-12 01:18:36.245997: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2024-03-12 01:18:36.274078: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2024-03-12 01:18:37.418090: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2024-03-12 01:18:39.183063: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1928] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 14083 MB memory: -> device: 0, name: NVIDIA GeForce RTX 4080, pci bus id: 0000:01:00.0, compute capability: 8.9 WARNING: All log messages before absl::InitializeLog() is called are written to STDERR W0000 00:00:1710177519.248527 2957036 asm_compiler.cc:252] Falling back to the CUDA driver for PTX compilation; ptxas does not support CC 8.9 W0000 00:00:1710177519.248551 2957036 asm_compiler.cc:255] Used ptxas at /usr/bin/ptxas 2024-03-12 01:18:39.248615: W tensorflow/compiler/mlir/tools/kernel_gen/transforms/gpu_kernel_to_blob_pass.cc:190] Failed to compile generated PTX with ptxas. Falling back to compilation by driver. Traceback (most recent call last): File "/mnt/work/dl-opt/GNN-MILP-main/2_training.py", line 119, in model = GCNPolicy(embSize, nConsF, nEdgeF, nVarF) File "/mnt/work/dl-opt/GNN-MILP-main/models.py", line 143, in init self.build([ File "/mnt/nfs/miniconda3/envs/dl-opt/lib/python3.10/site-packages/keras/src/layers/layer.py", line 224, in build_wrapper original_build_method(*args, *kwargs) File "/mnt/work/dl-opt/GNN-MILP-main/models.py", line 176, in build self.edge_embedding.build(ev_shape) File "/mnt/nfs/miniconda3/envs/dl-opt/lib/python3.10/site-packages/keras/src/layers/layer.py", line 224, in build_wrapper original_build_method(args, **kwargs) File "/mnt/nfs/miniconda3/envs/dl-opt/lib/python3.10/site-packages/keras/src/models/sequential.py", line 154, in build raise ValueError( ValueError: Sequential model sequential_1 cannot be built because it has no layers. Call model.add(layer).

Process finished with exit code 1

liujl11git commented 4 months ago

Hello,

Thanks for your interest in our codes.

The issue you reported seems to be related to the CUDA version. The version we suggested in "readme.md", CUDA 10.1, is too old for your device RTX 4080. According to [1], CUDA 10.x only supports compute capability 3.0-7.5, while RTX 4080's compute capability is 8.9 [2].

To fix the issue, you may try a newer version of cudatoolkit, with 11.8 or 12.x. Additionally, the TensorFlow version should be updated accordingly. For example, cuda 11.8 + tf 2.12.0 might be a good choice, according to [3]. However, it's important to note, as we haven't tested our codes with these newer versions, there may be unforeseen issues or additional requirements that need to be addressed.

Hope this can fix your questions.

[1] https://en.wikipedia.org/wiki/CUDA#GPUs_supported [2] https://developer.nvidia.com/cuda-gpus [3] https://www.tensorflow.org/install/source#gpu