1. 15 Sep, 2022 1 commit
    • Matt's avatar
      Update serving signatures and make sure we actually use them (#19034) · 2322eb8e
      Matt authored
      * Override save() to use the serving signature as the default
      
      * Replace int32 with int64 in all our serving signatures
      
      * Remember one very important line so as not to break every test at once
      
      * Dtype fix for TFLED
      
      * dtype fix for shift_tokens_right in general
      
      * Dtype fixes in mBART and RAG
      
      * Fix dtypes for test_unpack_inputs
      
      * More dtype fixes
      
      * Yet more mBART + RAG dtype fixes
      
      * Yet more mBART + RAG dtype fixes
      
      * Add a check that the model actually has a serving method
      2322eb8e
  2. 10 Sep, 2022 1 commit
  3. 09 Sep, 2022 1 commit
    • Matt's avatar
      Fix train_step, test_step and tests for CLIP (#18684) · 660e0b97
      Matt authored
      
      
      * Fix train_step and test_step, correctly enable CLIP fit test
      
      * Stop using get_args on older Python versions
      
      * Don't use get_origin either
      
      * UnionType is actually even newer, don't use that either
      
      * Apply the same fix to test_loss_computation
      
      * Just realized I was accidentally skipping a bunch of tests!
      
      * Fix test_loss_computation for models without separable labels
      
      * Fix scalar losses in test_step and train_step
      
      * Stop committing your breakpoints
      
      * Fix Swin loss shape
      
      * Fix Tapas loss shape
      
      * Shape fixes for TAPAS, DeIT, HuBERT and ViTMAE
      
      * Add loss computation to TFMobileBertForPreTraining
      
      * make fixup and move copied from statement
      
      * make fixup and move copied from statement
      
      * Correct copied from
      
      * Add labels and next_sentence_label inputs to TFMobileBERT
      
      * Make sure total_loss is always defined
      
      * Update tests/test_modeling_tf_common.py
      Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>
      
      * Fix copied from
      
      * Ensure CTC models get labels in tests
      
      * Ensure CTC models get labels in tests
      
      * Fix tests for vit_mae
      
      * Fix tests for vit_mae
      
      * Fix tests for vit_mae
      
      * Reduce batch size for wav2vec2 testing because it was causing OOM
      
      * Skip some TAPAS tests that are failing
      
      * Skip a failing HuBERT test
      
      * make style
      
      * Fix mobilebertforpretraining test
      
      * Skip Wav2Vec2 tests that use huge amounts of mem
      
      * Skip keras_fit for Wav2Vec2 as well
      Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>
      660e0b97
  4. 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
  5. 02 Sep, 2022 1 commit
  6. 01 Sep, 2022 1 commit
  7. 29 Aug, 2022 1 commit
  8. 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
  9. 04 Aug, 2022 2 commits
  10. 03 Aug, 2022 1 commit
  11. 01 Aug, 2022 1 commit
  12. 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
  13. 18 Jul, 2022 1 commit
  14. 13 Jul, 2022 1 commit
  15. 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
  16. 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
  17. 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
  18. 29 Jun, 2022 1 commit
  19. 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
  20. 21 Jun, 2022 2 commits
  21. 20 Jun, 2022 1 commit
  22. 09 Jun, 2022 2 commits
  23. 06 Jun, 2022 1 commit
  24. 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
  25. 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
  26. 25 Apr, 2022 1 commit
  27. 19 Apr, 2022 1 commit
  28. 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
  29. 06 Apr, 2022 1 commit
  30. 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
  31. 04 Apr, 2022 1 commit
  32. 01 Apr, 2022 1 commit
  33. 23 Mar, 2022 2 commits
  34. 19 Mar, 2022 1 commit
  35. 17 Mar, 2022 1 commit