uber / petastorm

Petastorm library enables single machine or distributed training and evaluation of deep learning models from datasets in Apache Parquet format. It supports ML frameworks such as Tensorflow, Pytorch, and PySpark and can be used from pure Python code.
Apache License 2.0
1.78k stars 285 forks source link

CI with Tensorflow 2.1 #536

Closed WeichenXu123 closed 4 years ago

WeichenXu123 commented 4 years ago

Now CI run on following env:

I replace all import tensorflow as tf with import tensorflow.compat.v1 as tf, so that all TF v1 API can be run on tensorflow 2.

Some changes on test:

Some change on source code:

codecov[bot] commented 4 years ago

Codecov Report

Merging #536 into master will decrease coverage by 0.05%. The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #536      +/-   ##
==========================================
- Coverage   86.53%   86.48%   -0.06%     
==========================================
  Files          85       85              
  Lines        4717     4721       +4     
  Branches      743      744       +1     
==========================================
+ Hits         4082     4083       +1     
- Misses        516      517       +1     
- Partials      119      121       +2     
Impacted Files Coverage Δ
setup.py 0.00% <ø> (ø)
petastorm/tf_utils.py 80.30% <83.33%> (-0.62%) :arrow_down:
...o_world/external_dataset/tensorflow_hello_world.py 100.00% <100.00%> (ø)
...al_dataset/tests/test_generate_external_dataset.py 96.29% <100.00%> (+0.14%) :arrow_up:
..._world/petastorm_dataset/tensorflow_hello_world.py 100.00% <100.00%> (ø)
...m_dataset/tests/test_generate_petastorm_dataset.py 96.55% <100.00%> (+0.12%) :arrow_up:
examples/mnist/tests/test_tf_mnist.py 100.00% <100.00%> (ø)
examples/mnist/tf_example.py 79.59% <100.00%> (ø)
..._dataset_converter/tensorflow_converter_example.py 85.10% <100.00%> (ø)
petastorm/benchmark/throughput.py 80.55% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 52c8c9f...8077d97. Read the comment docs.

WeichenXu123 commented 4 years ago

@selitvin Updated. One issue is, when I do this replace it with a new decorator create_tf_graph (without differentiating between TF2 and TF1), one error occur in Py2:

__________ ERROR collecting petastorm/tests/test_ngram_end_to_end.py ___________
In test_ngram_length_1_tf: function uses no argument 'reader_factory'
_____________ ERROR collecting petastorm/tests/test_tf_dataset.py ______________
In test_with_one_shot_iterator: function uses no argument 'reader_factory'

It should be pytest issue in py2. How to fix it ? Or we just remove CI for py2 ?