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

Tensorflow metadata #4944

Merged
merged 19 commits into from
Dec 8, 2023
Merged

Tensorflow metadata #4944

merged 19 commits into from
Dec 8, 2023

Conversation

RustedBones
Copy link
Contributor

@RustedBones RustedBones commented Jul 31, 2023

  • clean protoc configuration
  • download tensorflow metadata from released artifact
  • package tensorflow medatada with scio-tensorflow
  • depend on scio-tensorflow as provided in scio-parquet
  • use tfmd (tensorflow metadata) schema instead of me.lyh:parquet-tensorflow
  • create tensorflow example-parquet support based on official avro-parquet implementation

@codecov
Copy link

codecov bot commented Jul 31, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (d394cca) 63.43% compared to head (efa1a5f) 63.42%.
Report is 2 commits behind head on main.

❗ Current head efa1a5f differs from pull request most recent head 4337c24. Consider uploading reports for the commit 4337c24 to get more accurate results

Files Patch % Lines
...ify/scio/parquet/tensorflow/ParquetExampleIO.scala 84.61% 2 Missing ⚠️
...spotify/scio/parquet/read/ReadSupportFactory.scala 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4944      +/-   ##
==========================================
- Coverage   63.43%   63.42%   -0.01%     
==========================================
  Files         288      288              
  Lines       10807    10805       -2     
  Branches      785      778       -7     
==========================================
- Hits         6855     6853       -2     
  Misses       3952     3952              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RustedBones RustedBones force-pushed the tensorflow-metadata branch 3 times, most recently from 33ef09b to ac1be43 Compare July 31, 2023 12:15
@RustedBones RustedBones marked this pull request as ready for review July 31, 2023 13:24
build.sbt Show resolved Hide resolved
import org.tensorflow.metadata.v0.Schema;
import org.tensorflow.proto.example.Example;

public class ExampleWriteSupport extends WriteSupport<Example> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With such a big refactoring, it could be good to have a test validating that files written using .saveAsParquetExampleFile in Scio <= 0.13.1 can still be read using sc.parquetExampleFile going forward

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added and it works!
It is actually a good thing that the original schema was not stored in the extraMetadata as reusing the key would have created parsing issue (users would have to provide the schema as projection).

@RustedBones RustedBones force-pushed the tensorflow-metadata branch 2 times, most recently from 09849e1 to b8203a8 Compare August 3, 2023 12:01
@RustedBones
Copy link
Contributor Author

RustedBones commented Aug 3, 2023

There is something in the official documentation:

  • If a Feature K doesn't exist in an example, a K-specific default will be used, if configured.
  • If a Feature K exists in an example but contains no items, the intent is considered to be an empty tensor and no default will be used.

Right now, parquet storage doesn't do distinction between feature without items and omitted feature. Reconstructed Example omits the feature, which may not be what we want

@RustedBones RustedBones added this to the 0.14.0 milestone Aug 28, 2023
val filePattern = ScioUtil.filePattern(path, params.suffix)

Option(params.projection).foreach { projection =>
ExampleParquetInputFormat.setFields(job, projection.asJava)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be useless as the job is not used in the sdf implementation

Base automatically changed from v0.14.x to main November 29, 2023 07:52
@RustedBones RustedBones merged commit 1e0cb80 into main Dec 8, 2023
13 checks passed
@RustedBones RustedBones deleted the tensorflow-metadata branch December 8, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants