1. 07 Oct, 2022 3 commits
    • Sylvain Gugger's avatar
      Rework pipeline tests (#19366) · 9ac586b3
      Sylvain Gugger authored
      * Rework pipeline tests
      
      * Try to fix Flax tests
      
      * Try to put it before
      
      * Use a new decorator instead
      
      * Remove ignore marker since it doesn't work
      
      * Filter pipeline tests
      
      * Woopsie
      
      * Use the fitlered list
      
      * Clean up and fake modif
      
      * Remove init
      
      * Revert fake modif
      9ac586b3
    • Alara Dirik's avatar
      Improve and fix ImageSegmentationPipeline (#19367) · 983451a1
      Alara Dirik authored
      - Fixes the image segmentation pipeline test failures caused by changes to the postprocessing methods of supported models
      - Updates the ImageSegmentationPipeline tests
      - Improves docs, adds 'task' argument to optionally perform semantic, instance or panoptic segmentation
      983451a1
    • Amrit Sahu's avatar
      [WIP] Add ZeroShotObjectDetectionPipeline (#18445) (#18930) · e9a49bab
      Amrit Sahu authored
      * Add ZeroShotObjectDetectionPipeline (#18445)
      
      * Add AutoModelForZeroShotObjectDetection task
      
      This commit also adds the following
      
      - Add explicit _processor method for ZeroShotObjectDetectionPipeline.
        This is necessary as pipelines don't auto infer processors yet and
        `OwlVitProcessor` wraps tokenizer and feature_extractor together, to
        process multiple images at once
      
      - Add auto tests and other tests for ZeroShotObjectDetectionPipeline
      
      * Add AutoModelForZeroShotObjectDetection task
      
      This commit also adds the following
      
      - Add explicit _processor method for ZeroShotObjectDetectionPipeline.
        This is necessary as pipelines don't auto infer processors yet and
        `OwlVitProcessor` wraps tokenizer and feature_extractor together, to
        process multiple images at once
      
      - Add auto tests and other tests for ZeroShotObjectDetectionPipeline
      
      * Add batching for ZeroShotObjectDetectionPipeline
      
      * Fix doc-string ZeroShotObjectDetectionPipeline
      
      * Fix output format: ZeroShotObjectDetectionPipeline
      e9a49bab
  2. 05 Oct, 2022 2 commits
  3. 30 Sep, 2022 1 commit
  4. 29 Sep, 2022 1 commit
  5. 20 Sep, 2022 1 commit
  6. 15 Sep, 2022 1 commit
    • amyeroberts's avatar
      Update image segmentation pipeline test (#18731) · 30a28f52
      amyeroberts authored
      * Updated test values
      
      The image segmentation pipeline tests - tests/pipelines/test_pipelines_image_segmentation.py - were failing after the merging of #1849  (49e44b21). This was due to the difference in rescaling. Previously the images were rescaled by `image = image / 255`. In the new commit, a `rescale` method was added, and images rescaled using `image = image * scale`. This was known to cause small differences in the processed images (see
      [PR comment](https://github.com/huggingface/transformers/pull/18499#discussion_r940347575)).
      
      Testing locally, changing the `rescale` method to divide by a scale factor (255) resulted in the tests passing. It was therefore decided the test values could be updated, as there was no logic difference between the commits.
      
      * Use double quotes, like previous example
      
      * Fix up
      30a28f52
  7. 14 Sep, 2022 2 commits
    • Yih-Dar's avatar
      Fix `DocumentQuestionAnsweringPipelineTests` (#19023) · 6a9726ec
      Yih-Dar authored
      
      
      * Fix DocumentQuestionAnsweringPipelineTests
      Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
      6a9726ec
    • NielsRogge's avatar
      Add Deformable DETR (#17281) · 59407bbe
      NielsRogge authored
      
      
      * First draft
      
      * More improvements
      
      * Improve model, add custom CUDA code
      
      * Import torch before
      
      * Add script that imports custom layer
      
      * Add everything in new ops directory
      
      * Import custom layer in modeling file
      
      * Fix ARCHIVE_MAP typo
      
      * Creating the custom kernel on the fly.
      
      * Import custom layer in modeling file
      
      * More improvements
      
      * Fix CUDA loading
      
      * More improvements
      
      * Improve conversion script
      
      * Improve conversion script
      
      * Make it work until encoder_outputs
      
      * Make forward pass work
      
      * More improvements
      
      * Make logits match original implementation
      
      * Make implementation also support single_scale model
      
      * Add support for single_scale and dilation checkpoint
      
      * Add support for with_box_refine model
      
      * Support also two stage model
      
      * Improve tests
      
      * Fix more tests
      
      * Make more tests pass
      
      * Upload all models to the hub
      
      * Clean up some code
      
      * Improve decoder outputs
      
      * Rename intermediate hidden states and reference points
      
      * Improve model outputs
      
      * Move tests to dedicated folder
      
      * Improve model outputs
      
      * Fix retain_grad test
      
      * Improve docs
      
      * Clean up and make test_initialization pass
      
      * Improve variable names
      
      * Add copied from statements
      
      * Improve docs
      
      * Fix style
      
      * Improve docs
      
      * Improve docs, move tests to model folder
      
      * Fix rebase
      
      * Remove DetrForSegmentation from auto mapping
      
      * Apply suggestions from code review
      
      * Improve variable names and docstrings
      
      * Apply some more suggestions from code review
      
      * Apply suggestion from code review
      
      * better docs and variables names
      
      * hint to num_queries and two_stage confusion
      
      * remove asserts and code refactor
      
      * add exception if two_stage is True and with_box_refine is False
      
      * use f-strings
      
      * Improve docs and variable names
      
      * Fix code quality
      
      * Fix rebase
      
      * Add require_torch_gpu decorator
      
      * Add pip install ninja to CI jobs
      
      * Apply suggestion of @sgugger
      
      * Remove DeformableDetrForObjectDetection from auto mapping
      
      * Remove DeformableDetrModel from auto mapping
      
      * Add model to toctree
      
      * Add model back to mappings, skip model in pipeline tests
      
      * Apply @sgugger's suggestion
      
      * Fix imports in the init
      
      * Fix copies
      
      * Add CPU implementation
      
      * Comment out GPU function
      
      * Undo previous change
      
      * Apply more suggestions
      
      * Remove require_torch_gpu annotator
      
      * Fix quality
      
      * Add logger.info
      
      * Fix logger
      
      * Fix variable names
      
      * Fix initializaztion
      
      * Add missing initialization
      
      * Update checkpoint name
      
      * Add model to doc tests
      
      * Add CPU/GPU equivalence test
      
      * Add Deformable DETR to pipeline tests
      
      * Skip model for object detection pipeline
      Co-authored-by: default avatarNicolas Patry <patry.nicolas@protonmail.com>
      Co-authored-by: default avatarNouamane Tazi <nouamane98@gmail.com>
      Co-authored-by: default avatarSylvain Gugger <Sylvain.gugger@gmail.com>
      59407bbe
  8. 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
  9. 06 Sep, 2022 1 commit
  10. 02 Sep, 2022 1 commit
  11. 01 Sep, 2022 1 commit
    • OlivierDehaene's avatar
      Add Image To Text Generation pipeline (#18821) · ddb69e5a
      OlivierDehaene authored
      
      
      * Add Image2TextGenerationPipeline to supported pipelines
      
      * Add Flax and Tensorflow support
      
      * Add Flax and Tensorflow small tests
      
      * Add default model for Tensorflow
      
      * Add docstring
      
      * Fix doc style
      
      * Add tiny models for pytorch and flax
      
      * Remove flax from pipeline.
      Fix tests
      
      * Use ydshieh/vit-gpt2-coco-en as a default for both PyTorch and Tensorflow
      
      * Fix Tensorflow support
      Co-authored-by: default avatarOlivier Dehaene <olivier@huggingface.co>
      ddb69e5a
  12. 10 Aug, 2022 1 commit
  13. 09 Aug, 2022 1 commit
  14. 08 Aug, 2022 1 commit
    • Nicolas Patry's avatar
      [DX fix] Fixing QA pipeline streaming a dataset. (#18516) · a4562552
      Nicolas Patry authored
      * [DX fix] Fixing QA pipeline streaming a dataset.
      
      QuestionAnsweringArgumentHandler would iterate over the whole dataset
      effectively killing all properties of the pipeline.
      This restores nice properties when using `Dataset` or `Generator` since
      those are meant to be consumed lazily.
      
      * Handling TF better.
      a4562552
  15. 05 Aug, 2022 3 commits
    • Yih-Dar's avatar
    • Sylvain Gugger's avatar
      Fix pipeline tests (#18487) · 70fa1a8d
      Sylvain Gugger authored
      * Fix pipeline tests
      
      * Make sure all pipelines tests run with init changes
      70fa1a8d
    • Nicolas Patry's avatar
      Fixing issue where generic model types wouldn't load properly with the pipeline (#18392) · 586dcf6b
      Nicolas Patry authored
      * Adding a better error message when the model is improperly configured
      
      within transformers.
      
      * Update src/transformers/pipelines/__init__.py
      
      * Black version.
      
      * Overriding task aliases so that tokenizer+feature_extractor
      
      values are correct.
      
      * Fixing task aliases by overriding their names early
      
      * X.
      
      * Fixing feature-extraction.
      
      * black again.
      
      * Normalizing `translation` too.
      
      * Fixing last few corner cases.
      
      translation need to use its non normalized name (translation_XX_to_YY,
      so that the task_specific_params are correctly overloaded).
      This can be removed and cleaned up in a later PR.
      
      `speech-encode-decoder` actually REQUIRES to pass a `tokenizer` manually
      so the error needs to be discarded when the `tokenizer` is already
      there.
      
      * doc-builder fix.
      
      * Fixing the real issue.
      
      * Removing dead code.
      
      * Do not import the actual config classes.
      586dcf6b
  16. 02 Aug, 2022 1 commit
    • David's avatar
      Update pipeline word heuristic to work with whitespace in token offsets (#18402) · 042f4203
      David authored
      * Update pipeline word heuristic to work with whitespace in token offsets
      
      This change checks for whitespace in the input string at either the
      character preceding the token or in the first character of the token.
      This works with tokenizers that return offsets excluding whitespace
      between words or with offsets including whitespace.
      
      fixes #18111
      
      starting
      
      * Use smaller model, ensure expected tokenization
      
      * Re-run CI (please squash)
      042f4203
  17. 19 Jul, 2022 1 commit
  18. 15 Jul, 2022 1 commit
  19. 11 Jul, 2022 3 commits
  20. 01 Jul, 2022 1 commit
  21. 30 Jun, 2022 2 commits
  22. 29 Jun, 2022 2 commits
  23. 28 Jun, 2022 1 commit
    • Nicolas Patry's avatar
      Fixing a regression with `return_all_scores` introduced in #17606 (#17906) · 776855c7
      Nicolas Patry authored
      Fixing a regression with `return_all_scores` introduced in #17606
      
      - The legacy test actually tested `return_all_scores=False` (the actual
        default) instead of `return_all_scores=True` (the actual weird case).
      
      This commit adds the correct legacy test and fixes it.
      
      Tmp legacy tests.
      
      Actually fix the regression (also contains lists)
      
      Less diffed code.
      776855c7
  24. 13 Jun, 2022 2 commits
    • Daniel Stancl's avatar
      Add `LongT5` model (#16792) · a72f1c9f
      Daniel Stancl authored
      
      
      * Initial commit
      
      * Make some fixes
      
      * Make PT model full forward pass
      
      * Drop TF & Flax implementation, fix copies etc
      
      * Add Flax model and update some corresponding stuff
      
      * Drop some TF things
      
      * Update config and flax local attn
      
      * Add encoder_attention_type to config
      
      * .
      
      * Update docs
      
      * Do some cleansing
      
      * Fix some issues -> make style; add some docs
      
      * Fix position_bias + mask addition + Update tests
      
      * Fix repo consistency
      
      * Fix model consistency by removing flax operation over attn_mask
      
      * [WIP] Add PT TGlobal LongT5
      
      * .
      
      * [WIP] Add flax tglobal model
      
      * [WIP] Update flax model to use the right attention type in the encoder
      
      * Fix flax tglobal model forward pass
      
      * Make the use of global_relative_attention_bias
      
      * Add test suites for TGlobal model
      
      * Fix minor bugs, clean code
      
      * Fix pt-flax equivalence though not convinced with correctness
      
      * Fix LocalAttn implementation to match the original impl. + update READMEs
      
      * Few updates
      
      * Update: [Flax] improve large model init and loading #16148
      
      * Add ckpt conversion script accoring to #16853 + handle torch device placement
      
      * Minor updates to conversion script.
      
      * Typo: AutoModelForSeq2SeqLM -> FlaxAutoModelForSeq2SeqLM
      
      * gpu support + dtype fix
      
      * Apply some suggestions from code review
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * * Remove (de)parallelize stuff
      * Edit shape comments
      * Update README.md
      * make fix-copies
      
      * Remove caching logic for local & tglobal attention
      
      * Apply another batch of suggestions from code review
      
      * Add missing checkpoints
      * Format converting scripts
      * Drop (de)parallelize links from longT5 mdx
      
      * Fix converting script + revert config file change
      
      * Revert "Remove caching logic for local & tglobal attention"
      
      This reverts commit 2a619828f6ddc3e65bd9bb1725a12b77fa883a46.
      
      * Stash caching logic in Flax model
      
      * Make side relative bias used always
      
      * Drop caching logic in PT model
      
      * Return side bias as it was
      
      * Drop all remaining model parallel logic
      
      * Remove clamp statements
      
      * Move test files to the proper place
      
      * Update docs with new version of hf-doc-builder
      
      * Fix test imports
      
      * Make some minor improvements
      
      * Add missing checkpoints to docs
      * Make TGlobal model compatible with torch.onnx.export
      * Replace some np.ndarray with jnp.ndarray
      
      * Fix TGlobal for ONNX conversion + update docs
      
      * fix _make_global_fixed_block_ids and masked neg  value
      
      * update flax model
      
      * style and quality
      
      * fix imports
      
      * remove load_tf_weights_in_longt5 from init and fix copies
      
      * add slow test for TGlobal model
      
      * typo fix
      
      * Drop obsolete is_parallelizable and one warning
      
      * Update __init__ files to fix repo-consistency
      
      * fix pipeline test
      
      * Fix some device placements
      
      * [wip]: Update tests -- need to generate summaries to update expected_summary
      
      * Fix quality
      
      * Update LongT5 model card
      
      * Update (slow) summarization tests
      
      * make style
      
      * rename checkpoitns
      
      * finish
      
      * fix flax tests
      Co-authored-by: default avatarphungvanduy <pvduy23@gmail.com>
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarpatil-suraj <surajp815@gmail.com>
      a72f1c9f
    • Sijun He's avatar
      Add Visual Question Answering (VQA) pipeline (#17286) · 66336dc1
      Sijun He authored
      
      
      * wip
      
      * rebase
      
      * all tests pass
      
      * rebase
      
      * ready for PR
      
      * address comments
      
      * fix styles
      
      * add require_torch to pipeline test
      
      * remove remote image to improve CI consistency
      
      * address comments; fix tf/flax tests
      
      * address comments; fix tf/flax tests
      
      * fix tests; add alias
      
      * repo consistency tests
      
      * Update src/transformers/pipelines/visual_question_answering.py
      Co-authored-by: default avatarNielsRogge <48327001+NielsRogge@users.noreply.github.com>
      
      * address comments
      
      * Update src/transformers/pipelines/visual_question_answering.py
      Co-authored-by: default avatarNielsRogge <48327001+NielsRogge@users.noreply.github.com>
      
      * merge
      
      * Update src/transformers/models/auto/modeling_auto.py
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      
      * merge
      Co-authored-by: default avatarSijun He <sijunhe@Sijuns-MacBook-Pro.local>
      Co-authored-by: default avatarNielsRogge <48327001+NielsRogge@users.noreply.github.com>
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
      66336dc1
  25. 09 Jun, 2022 2 commits
    • Nicolas Patry's avatar
      Running a pipeline of `float16`. (#17637) · c38f4e1f
      Nicolas Patry authored
      When we're preparing the tensors for CPU for postprocessing, we need
      to upgrade the `float16` to `float32` since CPUs don't have instructions
      for `[b]float16`.
      c38f4e1f
    • Nicolas Patry's avatar
      Adding `top_k` argument to `text-classification` pipeline. (#17606) · 2351729f
      Nicolas Patry authored
      * Adding `top_k` and `sort` arguments to `text-classification` pipeline.
      
      - Deprecate `return_all_scores` as `top_k` is more uniform with other
        pipelines, and a superset of what `return_all_scores` can do.
        BC is maintained though.
        `return_all_scores=True` -> `top_k=None`
        `return_all_scores=False` -> `top_k=1`
      
      - Using `top_k` will imply sorting the results, but using no argument
        will keep the results unsorted for backward compatibility.
      
      * Remove `sort`.
      
      * Fixing the test.
      
      * Remove bad doc.
      2351729f
  26. 19 May, 2022 2 commits
  27. 18 May, 2022 1 commit