1. 07 Sep, 2022 1 commit
    • Ankur Goyal's avatar
      Add DocumentQuestionAnswering pipeline (#18414) · 2ef77421
      Ankur Goyal authored
      
      
      * [WIP] Skeleton of VisualQuestionAnweringPipeline extended to support LayoutLM-like models
      
      * Fixup
      
      * Use the full encoding
      
      * Basic refactoring to DocumentQuestionAnsweringPipeline
      
      * Cleanup
      
      * Improve args, docs, and implement preprocessing
      
      * Integrate OCR
      
      * Refactor question_answering pipeline
      
      * Use refactored QA code in the document qa pipeline
      
      * Fix tests
      
      * Some small cleanups
      
      * Use a string type annotation for Image.Image
      
      * Update encoding with image features
      
      * Wire through the basic docs
      
      * Handle invalid response
      
      * Handle empty word_boxes properly
      
      * Docstring fix
      
      * Integrate Donut model
      
      * Fixup
      
      * Incorporate comments
      
      * Address comments
      
      * Initial incorporation of tests
      
      * Address Comments
      
      * Change assert to ValueError
      
      * Comments
      
      * Wrap `score` in float to make it JSON serializable
      
      * Incorporate AutoModeLForDocumentQuestionAnswering changes
      
      * Fixup
      
      * Rename postprocess function
      
      * Fix auto import
      
      * Applying comments
      
      * Improve docs
      
      * Remove extra assets and add copyright
      
      * Address comments
      Co-authored-by: default avatarAnkur Goyal <ankur@impira.com>
      2ef77421
  2. 02 Sep, 2022 1 commit
  3. 01 Sep, 2022 1 commit
  4. 29 Aug, 2022 1 commit
  5. 05 Aug, 2022 1 commit
    • Sylvain Gugger's avatar
      Use new huggingface_hub tools for download models (#18438) · 5cd40323
      Sylvain Gugger authored
      * Draft new cached_file
      
      * Initial draft for config and model
      
      * Small fixes
      
      * Fix first batch of tests
      
      * Look in cache when internet is down
      
      * Fix last tests
      
      * Bad black, not fixing all quality errors
      
      * Make diff less
      
      * Implement change for TF and Flax models
      
      * Add tokenizer and feature extractor
      
      * For compatibility with main
      
      * Add utils to move the cache and auto-do it at first use.
      
      * Quality
      
      * Deal with empty commit shas
      
      * Deal with empty etag
      
      * Address review comments
      5cd40323
  6. 04 Aug, 2022 2 commits
  7. 03 Aug, 2022 1 commit
  8. 01 Aug, 2022 1 commit
  9. 22 Jul, 2022 1 commit
    • amyeroberts's avatar
      Update serving code to enable `saved_model=True` (#18153) · 8e838466
      amyeroberts authored
      
      
      * Add serving_output and serving methods to some vision models
      
      * Add serving outputs for DeiT
      
      * Don't convert hidden states - differing shapes
      
      * Make saveable
      
      * Fix up
      
      * Make swin saveable
      
      * Add in tests
      
      * Fix funnel tests (can't convert to tensor)
      
      * Fix numpy call
      
      * Tidy up a bit
      
      * Add in hidden states - resnet
      
      * Remove numpy
      
      * Fix failing tests - tensor shape and skipping tests
      
      * Remove duplicated function
      
      * PR comments - formatting and var names
      
      * PR comments
      Add suggestions made by Joao Gante:
      * Use tf.shape instead of shape_list
      * Use @tooslow decorator on tests
      * Simplify some of the logic
      
      * PR comments
      Address Yih-Dar Sheih comments - making tensor names consistent and make types float
      
      * Types consistent with docs; disable test on swin (slow)
      
      * CI trigger
      
      * Change input_features to float32
      
      * Add serving_output for segformer
      
      * Fixup
      Co-authored-by: default avatarAmy Roberts <amyeroberts@users.noreply.github.com>
      8e838466
  10. 18 Jul, 2022 1 commit
  11. 13 Jul, 2022 1 commit
  12. 04 Jul, 2022 1 commit
    • Matt's avatar
      Return scalar losses instead of per-sample means (#18013) · 96d833b2
      Matt authored
      * Return scalar losses instead of per-sample means
      
      * Make loss shape (1,) instead of scalar
      
      * Allow scalar losses in test_loss_computation
      
      * Allow scalar losses in test_loss_computation
      
      * Allow scalar losses in test_loss_computation
      
      * Remove XLA loss function for RAG
      96d833b2
  13. 01 Jul, 2022 1 commit
    • Matt's avatar
      XLA train step fixes (#17973) · d6cec458
      Matt authored
      * Copy inputs to train and test step before modifying them, as this breaks things
      
      * Add XLA tests, fix our loss functions to be XLA-compatible
      
      * make fixup
      
      * Update loss computation test to expect vector of per-sample losses
      
      * Patch loss for TFLED
      
      * Patch loss for TFAlbert
      
      * Add a tf_legacy_loss config flag that enables old loss functions
      
      * Stop using config.get() because it's not a dict
      
      * Skip loss computation test for RAG because its loss is very strange and I'm afraid to rewrite it
      
      * make fixup
      
      * Add XLA-compatible RAG loss
      
      * Fix dtype of loss mask for TFAlbert
      
      * Fix test for XLNet too because it overrides the default one
      
      * make fixup
      
      * Fix config test
      
      * No more depending on GPU NaN behaviour
      
      * Add test, avoid potential zero division
      
      * Fix test item assignment
      
      * Fix loss computation masking test
      
      * make fixup
      
      * Fix dtype bugs
      d6cec458
  14. 30 Jun, 2022 1 commit
    • Joao Gante's avatar
      CLI: convert sharded PT models (#17959) · 91e1f24e
      Joao Gante authored
      * sharded conversion; add flag to control max hidden error
      
      * better hidden name matching
      
      * Add test: load TF from PT shards
      
      * fix test (PT data must be local)
      91e1f24e
  15. 29 Jun, 2022 1 commit
  16. 23 Jun, 2022 1 commit
    • Matt's avatar
      Fix broken test for models with batchnorm (#17841) · 1a7ef334
      Matt authored
      * Fix tests that broke when models used batchnorm
      
      * Initializing the model twice does not actually...
      ...give you the same weights each time.
      I am good at machine learning.
      
      * Fix speed regression
      1a7ef334
  17. 21 Jun, 2022 2 commits
  18. 20 Jun, 2022 1 commit
  19. 09 Jun, 2022 2 commits
  20. 06 Jun, 2022 1 commit
  21. 17 May, 2022 1 commit
    • Matt's avatar
      Rewrite TensorFlow train_step and test_step (#17057) · 349f1c85
      Matt authored
      * Initial commit
      
      * Better label renaming
      
      * Remove breakpoint before pushing (this is your job)
      
      * Test a lot more in the Keras fit() test
      
      * make fixup
      
      * Clarify the case where we flatten y dicts into tensors
      
      * Clarify the case where we flatten y dicts into tensors
      
      * Extract label name remapping to a method
      349f1c85
  22. 12 May, 2022 2 commits
    • Sylvain Gugger's avatar
      Black preview (#17217) · afe5d42d
      Sylvain Gugger authored
      * Black preview
      
      * Fixup too!
      
      * Fix check copies
      
      * Use the same version as the CI
      
      * Bump black
      afe5d42d
    • Matt's avatar
      Add test to ensure models can take int64 inputs (#17210) · f04257fd
      Matt authored
      * Add test to ensure models can take int64 inputs
      
      * is_integer is an attribute, not a method
      
      * Fix test when some inputs aren't tensors
      
      * Add casts to blenderbot and blenderbot-small
      
      * Add casts to the other failing models
      f04257fd
  23. 25 Apr, 2022 1 commit
  24. 19 Apr, 2022 1 commit
  25. 11 Apr, 2022 1 commit
    • Yih-Dar's avatar
      Improve PT/TF equivalence test (#16557) · dce33f21
      Yih-Dar authored
      
      
      * add error message
      
      * Use names in the error message
      
      * allow ModelOutput
      
      * rename to check_pt_tf_outputs and move outside
      
      * fix style
      
      * skip past_key_values in a better way
      
      * Add comments
      
      * improve code for label/loss
      
      * make the logic clear by moving the ignore keys out
      
      * fix _postprocessing_to_ignore
      
      * fix _postprocessing_to_ignore: create new outputs from the remaining fields
      
      * ignore past_key_values in TFGPT2 models for now
      
      * make check_pt_tf_outputs better regarding names
      
      * move check_pt_tf_models outside
      
      * rename methods
      
      * remove test_pt_tf_model_equivalence in TFCLIPModelTest
      
      * Reduce TFViTMAEModelTest.test_pt_tf_model_equivalence
      
      * move prepare_pt_inputs_from_tf_inputs outside check_pt_tf_models
      
      * Fix quality
      
      * Clean-up TFLxmertModelTester.test_pt_tf_model_equivalence
      
      * Fix quality
      
      * fix
      
      * fix style
      
      * Clean-up TFLEDModelTest.test_pt_tf_model_equivalence
      
      * Fix quality
      
      * add docstring
      
      * improve comment
      Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
      dce33f21
  26. 06 Apr, 2022 1 commit
  27. 05 Apr, 2022 1 commit
    • Matt's avatar
      Adding new train_step logic to make things less confusing for users (#15994) · 43540052
      Matt authored
      
      
      * Adding new train_step logic to make things less confusing for users
      
      * DO NOT ASK WHY WE NEED THAT SUBCLASS
      
      * Metrics now working, at least for single-output models with type annotations!
      
      * Updates and TODOs for the new train_step
      
      * Make fixup
      
      * Temporary test workaround until T5 has types
      
      * Temporary test workaround until T5 has types
      
      * I think this actually works! Needs a lot of tests though
      
      * MAke style/quality
      
      * Revert changes to T5 tests
      
      * Deleting the aforementioned unmentionable subclass
      
      * Deleting the aforementioned unmentionable subclass
      
      * Adding a Keras API test
      
      * Style fixes
      
      * Removing unneeded TODO and comments
      
      * Update test_step too
      
      * Stop trying to compute metrics with the dummy_loss, patch up test
      
      * Make style
      
      * make fixup
      
      * Docstring cleanup
      
      * make fixup
      
      * make fixup
      
      * Stop expanding 1D input tensors when using dummy loss
      
      * Adjust T5 test given the new compile()
      
      * make fixup
      
      * Skipping test for convnext
      
      * Removing old T5-specific Keras test now that we have a common one
      
      * make fixup
      
      * make fixup
      
      * Only skip convnext test on CPU
      
      * Update src/transformers/modeling_tf_utils.py
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * Update src/transformers/modeling_tf_utils.py
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * Avoiding TF import issues
      
      * make fixup
      
      * Update compile() to support TF 2.3
      
      * Skipping model.fit() on template classes for now
      
      * Skipping model.fit() on template class tests for now
      
      * Replace ad-hoc solution with find_labels
      
      * make fixup
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      43540052
  28. 04 Apr, 2022 1 commit
  29. 01 Apr, 2022 1 commit
  30. 23 Mar, 2022 2 commits
  31. 19 Mar, 2022 1 commit
  32. 17 Mar, 2022 1 commit
  33. 14 Mar, 2022 1 commit
    • Yih-Dar's avatar
      Make TF pt-tf equivalence test more aggressive (#15839) · 923c35b5
      Yih-Dar authored
      
      
      * Make TF pt-tf equivalence test more aggressive
      
      * Fix for TFConvNextModelTest and TFTransfoXLModelTest
      
      * fix kwargs for outputs
      
      * clean-up
      
      * Add docstring for check_outputs()
      
      * remove: need to rename encoder-decoder
      
      * clean-up
      
      * send PyTorch things to the correct device
      
      * Add back the accidentally removed test case in test_pt_tf_model_equivalence()
      
      * Fix: change to tuple before calling check_outputs()
      
      * Fix: tfo could be a list
      
      * use to_tuple()
      
      * allow tfo only to be tuple or tensor
      
      * allow tfo to be list or tuple for now + style change
      
      * minor fix
      
      * remove np.copy and update comments
      
      * tfo -> tf_output, same for pt
      
      * Add more detailed comment
      
      * remove the incorrect comment
      Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
      923c35b5
  34. 02 Mar, 2022 1 commit
  35. 25 Feb, 2022 1 commit
    • Sayak Paul's avatar
      Add TFConvNextModel (#15750) · 84eaa6ac
      Sayak Paul authored
      
      
      * feat: initial implementation of convnext in tensorflow.
      
      * fix: sample code for the classification model.
      
      * chore: added checked for  from the classification model.
      
      * chore: set bias initializer in the classification head.
      
      * chore: updated license terms.
      
      * chore: removed ununsed imports
      
      * feat: enabled  argument during using drop_path.
      
      * chore: replaced tf.identity with layers.Activation(linear).
      
      * chore: edited default checkpoint.
      
      * fix: minor bugs in the initializations.
      
      * partial-fix: tf model errors for loading pretrained pt weights.
      
      * partial-fix: call method updated
      
      * partial-fix: cross loading of weights (4x3 variables to be matched)
      
      * chore: removed unneeded comment.
      
      * removed playground.py
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * fix: renaming TFConvNextStage conv and layer norm layers
      
      * chore: added initializers and other minor additions.
      
      * chore: added initializers and other minor additions.
      
      * add: tests for convnext.
      
      * fix: integration tester class.
      
      * fix: issues mentioned in pr feedback (round 1).
      
      * fix: how output_hidden_states arg is propoagated inside the network.
      
      * feat: handling of  arg for pure cnn models.
      
      * chore: added a note on equal contribution in model docs.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * feat: encapsulation for the convnext trunk.
      
      * Fix variable naming; Test-related corrections; Run make fixup
      
      * chore: added Joao as a contributor to convnext.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * chore: corrected copyright year and added comment on NHWC.
      
      * chore: fixed the black version and ran formatting.
      
      * chore: ran make style.
      
      * chore: removed from_pt argument from test, ran make style.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * fix: tests in the convnext subclass, ran make style.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * rebasing
      
      * rebasing and removing playground.py.
      
      * chore: moved convnext test to the correct location
      
      * fix: locations for the test file of convnext.
      
      * fix: convnext tests.
      
      * chore: applied  sgugger's suggestion for dealing w/ output_attentions.
      
      * chore: added comments.
      
      * chore: applied updated quality enviornment style.
      
      * chore: applied formatting with quality enviornment.
      
      * chore: revert to the previous tests/test_modeling_common.py.
      
      * chore: revert to the original test_modeling_common.py
      
      * chore: revert to previous states for test_modeling_tf_common.py and modeling_tf_utils.py
      
      * fix: tests for convnext.
      
      * chore: removed output_attentions argument from convnext config.
      
      * chore: revert to the earlier tf utils.
      
      * fix: output shapes of the hidden states
      
      * chore: removed unnecessary comment
      
      * chore: reverting to the right test_modeling_tf_common.py.
      
      * Styling nits
      Co-authored-by: default avatarariG23498 <aritra.born2fly@gmail.com>
      Co-authored-by: default avatarJoao Gante <joao@huggingface.co>
      Co-authored-by: default avatarSylvain Gugger <Sylvain.gugger@gmail.com>
      84eaa6ac