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
Autograph failure with \
#35765
Comments
TF autograph has bug handling `\` (tensorflow/tensorflow#35765)
TF autograph has bug handling `\` (tensorflow/tensorflow#35765)
Just ran into this as well, removing the slash fixed it. |
I am closing this as the related PR fix merged. Thanks! |
@jvishnuvardhan which PR fixed this bug? |
@emailweixu Sorry. I thought it was merged into |
TF autograph has bug handling `\` (tensorflow/tensorflow#35765)
Looks like a bug in the parser.
|
For a workaround until this is fixed, note that you can use parentheses to break expressions on multiple lines:
|
Currently, for some function, TF2 autograph will fail. See tensorflow/tensorflow#35765 tensorflow/tensorflow#30149 tensorflow/autograph#3 If autograph failed, the functions will be run eagerly and TF cannot optimize them. So we'd better address them. ## Manually test ~~~python df1 = spark.range(100) from petastorm.spark import make_spark_converter # Set a cache directory on DBFS FUSE for intermediate data. spark.conf.set("petastorm.spark.converter.parentCacheDirUrl", "file:///dbfs/ml/tmp/petastorm/QA/bugs/") converter1 = make_spark_converter(df1) with converter1.make_tf_dataset(num_epochs=1) as dataset: for batch in dataset: print(batch.id) ~~~ * Before Output includes: ``` WARNING:tensorflow:AutoGraph could not transform <function _NamedtupleCache.get at 0x7f0bfbe6f200> and will run it as-is. Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: expected exactly one node node, found [<gast.gast.FunctionDef object at 0x7f0bfad5d050>, <gast.gast.Return object at 0x7f0bfad5d7d0>] WARNING:tensorflow:AutoGraph could not transform <function make_petastorm_dataset.<locals>.<lambda> at 0x7f0bf8da03b0> and will run it as-is. Cause: could not parse the source code: .map(lambda row: _set_shape_to_named_tuple(reader.schema, row, reader.batched_output)) This error may be avoided by creating the lambda in a standalone statement. ``` * After The warnings listed above disappear.
Autograph isn't able to trace functions with a backslash continuation, see: tensorflow/tensorflow#35765
Currently, for some function, TF2 autograph will fail. See tensorflow/tensorflow#35765 tensorflow/tensorflow#30149 tensorflow/autograph#3 If autograph failed, the functions will be run eagerly and TF cannot optimize them. So we'd better address them. ## Manually test ~~~python df1 = spark.range(100) from petastorm.spark import make_spark_converter # Set a cache directory on DBFS FUSE for intermediate data. spark.conf.set("petastorm.spark.converter.parentCacheDirUrl", "file:///dbfs/ml/tmp/petastorm/QA/bugs/") converter1 = make_spark_converter(df1) with converter1.make_tf_dataset(num_epochs=1) as dataset: for batch in dataset: print(batch.id) ~~~ * Before Output includes: ``` WARNING:tensorflow:AutoGraph could not transform <function _NamedtupleCache.get at 0x7f0bfbe6f200> and will run it as-is. Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: expected exactly one node node, found [<gast.gast.FunctionDef object at 0x7f0bfad5d050>, <gast.gast.Return object at 0x7f0bfad5d7d0>] WARNING:tensorflow:AutoGraph could not transform <function make_petastorm_dataset.<locals>.<lambda> at 0x7f0bf8da03b0> and will run it as-is. Cause: could not parse the source code: .map(lambda row: _set_shape_to_named_tuple(reader.schema, row, reader.batched_output)) This error may be avoided by creating the lambda in a standalone statement. ``` * After The warnings listed above disappear.
Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template
System information
Describe the current behavior
Tensorflow shows warning about failure of autograph
The warning seems to be caused by the backslash
"\"
.Describe the expected behavior
There should be no such warning
Code to reproduce the issue
The text was updated successfully, but these errors were encountered: