Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf-1.10.1 freeze_graph 'list index out of range' #22029

Closed
jiarenyf opened this issue Sep 3, 2018 · 7 comments · Fixed by #86134
Closed

tf-1.10.1 freeze_graph 'list index out of range' #22029

jiarenyf opened this issue Sep 3, 2018 · 7 comments · Fixed by #86134
Assignees

Comments

@jiarenyf
Copy link

jiarenyf commented Sep 3, 2018

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes.
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.10.1
  • Python version: 2.7.12
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: 9.0 / 7.1
  • GPU model and memory: N/A
  • Exact command to reproduce: N/A

Describe the problem

I use the following command to freeze a ckpt file to pb file:

    freeze_graph(
        input_saver=None,
        input_graph=pbTxt,
        input_binary=False,
        clear_devices=True,
        output_graph=pbPath,
        restore_op_name=None,
        initializer_nodes="",
        input_meta_graph=None,
        filename_tensor_name=None,
        input_saved_model_dir=None,
        output_node_names=outputOp,
        variable_names_blacklist='',
        input_checkpoint=iCheckpoint,
    )

In tf-1.8.0 everything seems well, however in tf-1.10.1, I meet the following error:

  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/tools/freeze_graph.py", line 254, in freeze_graph
    checkpoint_version=checkpoint_version)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/tools/freeze_graph.py", line 128, in freeze_graph_with_def_protos
    var_list=var_list, write_version=checkpoint_version)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1281, in __init__
    self.build()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1293, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1330, in _build
    build_save=build_save, build_restore=build_restore)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 756, in _build_internal
    saveables = self._ValidateAndSliceInputs(names_to_saveables)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 663, in _ValidateAndSliceInputs
    for converted_saveable_object in self.SaveableObjectsForOp(op, name):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 637, in SaveableObjectsForOp
    variable, "", name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 121, in __init__
    self.handle_op = var.op.inputs[0]
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2001, in __getitem__
    return self._inputs[i]
IndexError: list index out of range

I wonder why the tf-1.10 is not tested before release ???

@tensorflowbutler tensorflowbutler added the stat:awaiting response Status - Awaiting response from author label Sep 4, 2018
@tensorflowbutler
Copy link
Member

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
GPU model and memory
Exact command to reproduce

@jiarenyf
Copy link
Author

jiarenyf commented Sep 4, 2018

@tensorflowbutler Updated.

@rainmaker712
Copy link

same issues #22019

If I use tensorflow 1.10 version freeze graph.py, it comes with
ImportError: cannot import name 'checkpoint_management' tf1.10

If I use working version such as tensorflow 1.8, message comes below

Traceback (most recent call last):
File "freeze_graph.py", line 382, in
run_main()
File "freeze_graph.py", line 379, in run_main
app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "freeze_graph.py", line 378, in
my_main = lambda unused_args: main(unused_args, flags)
File "freeze_graph.py", line 272, in main
flags.saved_model_tags, checkpoint_version)
File "freeze_graph.py", line 254, in freeze_graph
checkpoint_version=checkpoint_version)
File "freeze_graph.py", line 128, in freeze_graph_with_def_protos
var_list=var_list, write_version=checkpoint_version)
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1281, in init
self.build()
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1293, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
build_save=build_save, build_restore=build_restore)
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 756, in _build_internal
saveables = self._ValidateAndSliceInputs(names_to_saveables)
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 663, in _ValidateAndSliceInputs
for converted_saveable_object in self.SaveableObjectsForOp(op, name):
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 637, in SaveableObjectsForOp
variable, "", name)
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 121, in init
self.handle_op = var.op.inputs[0]
File "/home/companyai8way/tf110/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2001, in getitem
return self._inputs[i]
IndexError: list index out of range

@reedwm
Copy link
Member

reedwm commented Sep 4, 2018

/CC @petewarden, can you take a look?

@reedwm reedwm assigned petewarden and unassigned reedwm Sep 4, 2018
@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Sep 4, 2018
@jiarenyf
Copy link
Author

@petewarden Help ...

@tensorflowbutler
Copy link
Member

Nagging Assignee @petewarden: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

@jiarenyf
Copy link
Author

Tensorflow is hard to use with so many bugs, I wonder why not fixing bugs before developing new functionality.

And the issue block on github is useless, since no useful answers are provided. I wonder maybe turn to using pytorch would be better.

copybara-service bot pushed a commit that referenced this issue Jan 29, 2025
…(Blackwell)

Imported from GitHub PR openxla/xla#22029

In addition to SM120a, also add SM101a mentioned in the PTX 8.7 spec (https://docs.nvidia.com/cuda/parallel-thread-execution/#release-notes), which is a slight variation of SM100a.

Bumping the max supported PTX version to 8.7, as the LLVM PR (llvm/llvm-project#124155) adding the support is now integrated to OpenXLA.
Copybara import of the project:

--
be59b7a51721637d880207e7adb69a18c3a92bea by Sergey Kozub <[email protected]>:

[XLA:GPU] Add support for SM101a and SM120a architectures (Blackwell)

Merging this change closes #22029

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#22029 from openxla:devel/sm120a be59b7a51721637d880207e7adb69a18c3a92bea
PiperOrigin-RevId: 721049239
copybara-service bot pushed a commit that referenced this issue Jan 29, 2025
…(Blackwell)

Imported from GitHub PR openxla/xla#22029

In addition to SM120a, also add SM101a mentioned in the PTX 8.7 spec (https://docs.nvidia.com/cuda/parallel-thread-execution/#release-notes), which is a slight variation of SM100a.

Bumping the max supported PTX version to 8.7, as the LLVM PR (llvm/llvm-project#124155) adding the support is now integrated to OpenXLA.
Copybara import of the project:

--
be59b7a51721637d880207e7adb69a18c3a92bea by Sergey Kozub <[email protected]>:

[XLA:GPU] Add support for SM101a and SM120a architectures (Blackwell)

Merging this change closes #22029

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#22029 from openxla:devel/sm120a be59b7a51721637d880207e7adb69a18c3a92bea
PiperOrigin-RevId: 721049239
copybara-service bot pushed a commit that referenced this issue Jan 29, 2025
…(Blackwell)

Imported from GitHub PR openxla/xla#22029

In addition to SM120a, also add SM101a mentioned in the PTX 8.7 spec (https://docs.nvidia.com/cuda/parallel-thread-execution/#release-notes), which is a slight variation of SM100a.

Bumping the max supported PTX version to 8.7, as the LLVM PR (llvm/llvm-project#124155) adding the support is now integrated to OpenXLA.
Copybara import of the project:

--
be59b7a51721637d880207e7adb69a18c3a92bea by Sergey Kozub <[email protected]>:

[XLA:GPU] Add support for SM101a and SM120a architectures (Blackwell)

Merging this change closes #22029

PiperOrigin-RevId: 721088886
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants