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

Add FirebasePublisher Implementation #175

Merged
merged 44 commits into from
Aug 31, 2022

Conversation

deep-diver
Copy link
Contributor

@deep-diver deep-diver commented Aug 23, 2022

This is a draft PR. Some codes, doc-strings, and comments should be polished. Once they are done, reviews will be requested.

it is now ready. lmk if unit tests are required.

cc: @sayakpaul

@github-actions
Copy link
Contributor

Thanks for the PR! 🚀

Instructions: Approve using /lgtm and mark for automatic merge by using /merge.

@casassg
Copy link
Member

casassg commented Aug 24, 2022

Btw would love feedback on precommit docs at CONTRIBUTING.md to make sure they make sense

@deep-diver
Copy link
Contributor Author

Thanks for the comment @casassg :)
Will check out the CONTRIBUTING.md, and I will request reviews by today or tomorrow

@deep-diver
Copy link
Contributor Author

@casassg

should I write unit tests? I have checked it works

@deep-diver deep-diver marked this pull request as ready for review August 25, 2022 09:28
@casassg
Copy link
Member

casassg commented Aug 25, 2022

Preferably some small unit tests would be great. That helps us do upgrades of dependencies while making sure it's fine. As an example, it helps us bump up what version of tfx is compatible without requiring all contributors to test their components individually for each upgrade.

@deep-diver
Copy link
Contributor Author

@casassg

some tests are added

@casassg
Copy link
Member

casassg commented Aug 31, 2022

Seems CI unfortunately still timesout. can you try running locally pip install --dry-run --ignore-installed -e ".[ci_min, firebase_publisher]" This will attempt to resolve the component against our lower support TFX (aka TFX 1.4). ( you may need to upgrade pip - pip install --upgrade pip in order to get --dry-run).

Guessing you may need even a lower version of firebase-admin. It seems to be conflicting with versions of shared google libraries that beam and tensorflow depend on for TFX 1.4

@casassg
Copy link
Member

casassg commented Aug 31, 2022

(also if you don't mind can you set the name of the PR to something that describes better the change? We use PR titles as release notes on release)

@deep-diver deep-diver changed the title Feat/firebase publisher Add FirebasePublisher Implementation Aug 31, 2022
@deep-diver
Copy link
Contributor Author

when I run pip install --dry-run --ignore-installed -e ".[ci_min, firebase_publisher]", I get the following error:
ERROR: No matching distribution found for tfx<1.10.0,>=1.4.0; extra == "firebase_publisher"

@casassg
Copy link
Member

casassg commented Aug 31, 2022

What python version are you in? You may need to reduce the version of python to one that is supported by tfx 1.4

@deep-diver
Copy link
Contributor Author

deep-diver commented Aug 31, 2022

I was in Python 3.10, let me try with 3.8

@deep-diver
Copy link
Contributor Author

I get the same errors with Python 3.6, 3.7, 3.8, 3.9

@casassg
Copy link
Member

casassg commented Aug 31, 2022

Okay, I think I found a fix. Change this in version.py

_CI_MIN_CONSTRAINTS = [
    f"tfx~={_INCLUSIVE_MIN_TFX_VERSION}", "tensorflow~=2.6.0",
    "apache-beam[gcp]<2.35", "firebase-admin<5.0.3"
]

The issue is due to https://github.com/firebase/firebase-admin-python/releases/tag/v5.0.3 adding google-api-core 2.X which breaks a lot of stuff w tfx 1.4 and similar as those were released before the 2.X changes. This triggers a tone of backtracking with pip, the fix above just basically tells our CI to bothering looking at any version of firebase_admin above 5.0.3 so it doesnt go down the rabithole of backtracking

@deep-diver
Copy link
Contributor Author

great! should I fix version.py or are you going to?

@casassg
Copy link
Member

casassg commented Aug 31, 2022

you should fix it as part of the PR as otherwise CI wont let you merge it (as CI as of now its failing)

@deep-diver
Copy link
Contributor Author

I am a little confused, how should I write

_CI_MIN_CONSTRAINTS = [
    f"tfx~={_INCLUSIVE_MIN_TFX_VERSION}", "tensorflow~=2.6.0",
    "apache-beam[gcp]<2.35", "firebase-admin<5.0.3"
]

into version.py ?

since other packages are already defined in _CI_MIN_CONSTRAINTS, I just need like

    "firebase_publisher":
    [f"tfx{_TFXVERSION_CONSTRAINT}", "firebase-admin>=5.0.3,<6.0.0"],

is this right?

@casassg
Copy link
Member

casassg commented Aug 31, 2022

Sorry I should have specified more. I meant if you can add "firebase-admin<5.0.3" to

_CI_MIN_CONSTRAINTS = [

You will need to leave _PKG_METADATA as is but we need modify the CI constraints in order to make sure we can test the component at all

@casassg
Copy link
Member

casassg commented Aug 31, 2022

I believe I may also be able to commit to your branch if you prefer me to do that

@deep-diver
Copy link
Contributor Author

please do

@casassg
Copy link
Member

casassg commented Aug 31, 2022

this looks better now :D /lgtm

will let you merge at your own discretion (just comment the merge command to merge that should merge the code)

@github-actions
Copy link
Contributor

Approval received from @casassg! ✅

PR is approved. Missing merge command to auto-merge PR!

@deep-diver
Copy link
Contributor Author

/merge

@deep-diver
Copy link
Contributor Author

oh it looks like there is a pending review by @hanneshapke
I will wait until he checks this out then. Huge thanks @casassg

@github-actions github-actions bot merged commit 11e0006 into tensorflow:main Aug 31, 2022
@github-actions
Copy link
Contributor

Merged with approvals from casassg - thanks for the contribution! 🎉

hanneshapke pushed a commit to digits/tfx-addons that referenced this pull request Apr 3, 2023
* add empty __init__.py

* add component.py

* add component spec

* add executor.py

* unncessary codes from custom_config

* initial implementation done

* fix typo

* re-organize the runner

* pre-commit

* pre-commit

* add docstring for the component

* add basic unit tests

* add basic unit tests

* change private to public

* change function call name

* pass pre-commit

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/component.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/component.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/executor.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* remove mis-placed docstring in the component

* fix full-step consistency

* rename model_exist -> is_model_present

* rename upload_model -> upload_model_to_gcs

* more descriptions on update_model

* update log message on model_create

* fix case inconsistency

* fix pre-commit

* add copyright

* add import module in __init__.py

* add firebase_publisher version info

* fix typo

* remove ValueError in docstring

* update docstring

* fix: pre-commit

* fix: pre-commit

* update function name in the test module

* add copyrights

* reduce version requirement

* remove version info in __init__.py

* add constraint for firebase in CI

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>
github-actions bot pushed a commit that referenced this pull request Apr 11, 2023
* initial move of the existing mct code

* Added missing file

* Added (unreviewed) MCT example

* updated example

* extended doc

* add census helper files

* Create 20220513-PandasTransform.md

First draft of project proposal.

* Update 20220513-PandasTransform.md

Oops, forgot to add the dependencies!

* Update 20220513-PandasTransform.md

Adding a note about statistics and schema for the changed dataset.

* Rcrowe fixing filename (#140)

* Create 20220513-pandas_transform.md

* Delete 20220513-PandasTransform.md

* Update README.md (#142)

Fixing broken links on PyPI page.

* fix bad link in xgboost_evaluator

* Update CODEOWNERS

* Cherry pick bot to backport changes (#144)

* Cherry pick bot to backport changes

* Update RELEASE.md

* validate user is release manager

* Update examples for feature selection component (#116)

* Updated module file for compatibility

* Updated module file for compatibility

* Update iris_module_file.py

* Created Palmer Penguins example using Colaboratory

* Created Pima Indians Diabetes example pipeline using Colaboratory

* Created Iris example pipeline using Colaboratory

* Deleted outdated file + replaced with new examples

* Deleted outdated file

* Fix bad link in xgboost_evaluator (#145)

Commit 93fd006 didn't correctly fix the link.

* Increase supported version from TFX <1.8 to <1.9  (#147)

* include TFX 1.8

* increase CI

* switch cache key to constaint first

* remove shared cache

* fix exit handler

* fix patch issues

* reformating yapf

* Use feast from master git to avoid pip infinite backtrack (#152)

* pin pip

* Update ci.yml

* use requirements max and min instead

* add missing letter

* fix using -r option

* ammend triggers

* add tensorflow to the mix

* tf 2.6

* move constraints to version file

* pin api-core

* add protobuf

* protobuf 3.19

* add mlp-sdk

* add extras for api-core

* add it to requirements instead

* move feast dep

* use feast repo instead of release

* remove mlpipeline-sdk

* Updated readme with module file guidelines and example (#151)

* bump feast version support (#154)

* Add feature_selection to included pkg (#161)

* add feature_selection to included pkg

* upgrade tfx to avoid beam issue in sklearn example

* fix due to upgrade of tfma

* fix missing 1 types

* format inline

* update extractor test

* remove the header generator

* break down CI by component

* use file.json

* use python file

* use correct base_dir

* touch for feast_examplegen

* ensure it works fine

* run if certain dangerous files change

* removed non used files and update CONTRIBUTING

* improve a bit how variable is set

* revert change in feastexamplegen

* remove non used variable in version.py

* rename job phase

* cancel if new ones

* add some extra space

* add note on inspiration

* PandasTransform - Ready for review (#155)

* Initial commit

* Fixing lint

* More lint

* Yet more lint

* Oops, whitespace

* Unused imports

* More cleanup

* Misc cleanup

* Fixed a couple of things

* Fixing astype

* Disabling unnecessary-comprehension

* Oops, wrong comprehension

* Trying to improve version handling

* Order of imports

* Removing reimport

* Adding version check to tests

* Missed the beam pipeline on the min

* Indents on the test params

* Lint wants the else formatted differently

* Adding an example and update to pydoc for component

* Adding README and release notes

* Added beam_pipeline_args, updated README

* Trying to fix lint

* Adding dependencies

* Lint, maybe yapf fixes

* Trying to fix formatting

* Capping Pandas version, updating CODEOWNERS

* Various updates pre-merge

* support tfx 1.9 (#162)

* small fix for filter projects (#164)

* small fix for filter projects

* Update ci.yml

* Update README to add missing component (#165)

* Update README.md

* fix pandas_transform

* Added release notes for feature selection component (#150)

* Update CONTRIBUTING.md

* Create README.md

Adding a readme to the example

* Create requirements.txt

Adding requirements.txt to the example.  Only referencing the component, since that will keep all other dependencies in one place.

* Added tests for feature selection component (#149)

* Initial commit with working tests

* cleaned and ensured the file is working with pre-commit

* Testing checkpoint

* Added support for module_file

* Improved documentation

* Fixed test

* Fixed pre-commit errors

* Added data files for component_test.py

* Added tests for artifact count by type

* Fixed minor bug

* Added test to check if correct features are being selected

* Update dependencies for feature_selection

* Update tfx_addons/version.py

* Update tfx_addons/version.py

* Update tfx_addons/version.py

Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>

* Improve examples CI to automatically pick up projects (#166)

* make ci_examples run only when needed

* remove non used init file

* only run those examples that have test files

* address comments and improve documentation

* add concurrency for ci-examples

* CI: Run all if event name is push (#167)

* if event name is push run all projects

* remove non-used RUN_ALL_FILE

* run ci-examples if changes in filter_examples

* add comment on why env name

* add better logging

* Move main to 0.4 after 0.3 release

* Update RELEASE.md (#170)

* update firebase publisher proposal (#171)

* update firebase publisher proposal

update firebase publisher proposal with more detailed descriptions

* remove vague word temporary

* replace custom_config with concrete parameters

* Update tfx_addons/firebase_publisher/README.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* clarify usage of SavedModel

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* HFModelPusher component proposal (#174)

* write HFModelPusher component proposal

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* commit_id in the outputs, more desc on the branching

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* fix: missing option --hook-type (#177)

fix: missing option `--hook-type` in "Install pre-commit hooks for push hooks: `pre-commit install --hook-type pre-push`"

* Scaling Sampler by using row level probability (#163)

* initial probabilistic sampling

* using sampled in batches

* use toDict

* use calculation for sampling by class

* implement using sampling at individual level

* fixup readme

* improve executor docs

* use patch to avoid flaky tests

* Add FirebasePublisher Implementation (#175)

* add empty __init__.py

* add component.py

* add component spec

* add executor.py

* unncessary codes from custom_config

* initial implementation done

* fix typo

* re-organize the runner

* pre-commit

* pre-commit

* add docstring for the component

* add basic unit tests

* add basic unit tests

* change private to public

* change function call name

* pass pre-commit

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/component.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/component.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/executor.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update tfx_addons/firebase_publisher/runner.py

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* remove mis-placed docstring in the component

* fix full-step consistency

* rename model_exist -> is_model_present

* rename upload_model -> upload_model_to_gcs

* more descriptions on update_model

* update log message on model_create

* fix case inconsistency

* fix pre-commit

* add copyright

* add import module in __init__.py

* add firebase_publisher version info

* fix typo

* remove ValueError in docstring

* update docstring

* fix: pre-commit

* fix: pre-commit

* update function name in the test module

* add copyrights

* reduce version requirement

* remove version info in __init__.py

* add constraint for firebase in CI

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>

* update HFModelPusher proposal

* add space_url in the output

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Update proposals/20220823-huggingface_model_pusher.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Archive penguins_sklearn example (#184)

* Update README.md

Archived and pointed to example in main TFX repo.

* Update penguin_pipeline_sklearn_gcp.py

Commenting out to avoid issues while archived.

* Update penguin_pipeline_sklearn_gcp_test.py

Commenting out to avoid CI issues while archived.

* Update penguin_pipeline_sklearn_local.py

Commenting out to avoid CI issues while archived.

* Update penguin_pipeline_sklearn_local_e2e_test.py

Commenting out to avoid CI issues while archived.

* Update penguin_pipeline_sklearn_local.py

* Update penguin_utils_sklearn.py

Commented out to avoid CI issues while archived

* Update sklearn_predict_extractor.py

Commented out to avoid CI issues while archived.

* Update sklearn_predict_extractor_test.py

Commented out to avoid CI issues while archived.

* Update requirements.txt

Commenting out to avoid CI issues while archived

* Update Dockerfile

Commenting out to avoid CI issues while archived

* Update penguin_utils_sklearn.py

Lint

* Update sklearn_predict_extractor.py

Lint

* Update sklearn_predict_extractor.py

Lint

* Update penguin_pipeline_sklearn_gcp.py

Lint

* Update penguin_pipeline_sklearn_gcp_test.py

Lint

* Update penguin_pipeline_sklearn_local.py

Lint

* Update penguin_pipeline_sklearn_local_e2e_test.py

Lint

* Update penguin_utils_sklearn.py

Lint

* Update sklearn_predict_extractor_test.py

Lint

* Update sklearn_predict_extractor_test.py

Lint

* Update penguin_utils_sklearn.py

Lint

* Update sklearn_predict_extractor.py

Lint

* Update sklearn_predict_extractor_test.py

Lint

* Update penguin_pipeline_sklearn_gcp_test.py

* Update penguin_pipeline_sklearn_local_e2e_test.py

Null test to satisfy CI

* Update sklearn_predict_extractor_test.py

Null test to satisfy CI

* Update penguin_pipeline_sklearn_gcp_test.py

Lint

* Update penguin_pipeline_sklearn_local_e2e_test.py

Lint

* Update sklearn_predict_extractor_test.py

Lint

* Update penguin_pipeline_sklearn_local_e2e_test.py

Lint

* Update penguin_pipeline_sklearn_gcp_test.py

Lint

* Update penguin_pipeline_sklearn_gcp_test.py

Lint

* Update penguin_pipeline_sklearn_local_e2e_test.py

Lint

* Update sklearn_predict_extractor_test.py

Lint

* remove files and include reference to existing code

Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>

* remove old data (#185)

* PyTorch TFX proposal

* clean up of CODEOWNERS (#188)

* Support TFX 1.10 (#187)

* Initial release candidate testing for tfx==1.10.0rc0

* remove suffux from test_utils

* add missing extra line

* use tfx 1.10 constraint

* add firebase_publisher to readme

* Add HF pusher owners (#192)

* Add HuggingFace Pusher Implementation (#191)

* add hfpusher implementation

* update version.py

* add test for runner.py

* linting

* add dependency

* add pytest ignore protected access

* add one more test

* fix: test failure

* copy proposa as README

* add git-lfs dependency

* document about RuntimeError when git-lfs is not installed

* add _is_git_lfs_installed

* add test cases for executor

* change _executor -> exe

* yapf

* Update tfx_addons/huggingface_pusher/README.md

Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>

* Update tfx_addons/huggingface_pusher/executor_test.py

Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>

* add huggingface document reference for git-lfs

* space_config example added to component_test

* yapf

* add optional decrypt features

* add decrypt_fn in README

Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>

* initial move of the existing mct code

* Added missing file

* Added (unreviewed) MCT example

* updated example

* extended doc

* add census helper files

* updated mct version dependency

* yapf + isort updates

* updated gitignore to ignore notebook generated files

* isort updated

* removed notebook example generated files

* removed model_card_pb2.SensitiveData() and model_card_pb2.ConfidenceInterval()

* updated formatting

* updated example notebook

* updated example notebook for the MCT component

* updated example notebook for the MCT component

* set the code owners for the MCT component

* Update RELEASE.md

* Update RELEASE.md

* added tfxtest

* added tfxtest

* updated .gitignore

* fix typo in CODEOWNERS

* Update .gitignore

---------

Co-authored-by: Robert Crowe <robertcrowe@google.com>
Co-authored-by: Gerard Casas Saez <gcasassaez@twitter.com>
Co-authored-by: Kshitijaa Jaglan <29124655+deutranium@users.noreply.github.com>
Co-authored-by: Jeroen Van Goey <jeroen.vangoey@gmail.com>
Co-authored-by: Chansung Park <deep.diver.csp@gmail.com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants