1. 31 Dec, 2022 1 commit
  2. 23 Dec, 2022 1 commit
    • Nicolas Patry's avatar
      Adding support for `fp16` for asr pipeline. (#20864) · f7f0ec2f
      Nicolas Patry authored
      * Supporting `fp16` for asr pipeline
      
      * Adding test.
      
      * Style.
      
      * Oops.
      
      * Flake8 update ?
      
      * Fixing flake8 ?
      
      * Revert "Flake8 update ?"
      
      This reverts commit 0b917fcb520e5f34d1933d9d37d8f32b64553048.
      
      * Style (acctidentally deleted flake8 F401.)
      
      * Move to a bigger test (no small whisper model, and s2t doesn't seem to
      accept torch_dtype=fp16).
      
      Also we need to use a GPU to actually compute on fp16.
      
      * Using BatchFeature capability.
      f7f0ec2f
  3. 06 Dec, 2022 1 commit
  4. 05 Dec, 2022 1 commit
  5. 14 Nov, 2022 1 commit
  6. 18 Oct, 2022 1 commit
  7. 14 Oct, 2022 1 commit
    • Nicolas Patry's avatar
      Improve error messaging for ASR pipeline. (#19570) · 463226e2
      Nicolas Patry authored
      * Improve error messaging for ASR pipeline.
      
      - Raise error early (in `_sanitize`) so users don't waste time trying to
        run queries with invalid params.
      
      - Fix the error was after using `config.inputs_to_logits_ratio` so our
        check was masked by the failing property does not exist.
      
      - Added some manual check on s2t for the error message.
        No non ctc model seems to be used by the default runner (they are all
        skipped).
      
      * Removing pdb.
      
      * Stop the early error it doesn't really work :(.
      463226e2
  8. 11 Oct, 2022 1 commit
    • Arthur's avatar
      Fix whisper for `pipeline` (#19482) · b722a6be
      Arthur authored
      * update feature extractor params
      
      * update attention mask handling
      
      * fix doc and pipeline test
      
      * add warning when skipping test
      
      * add whisper translation and transcription test
      
      * fix build doc test
      b722a6be
  9. 07 Oct, 2022 1 commit
    • 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
  10. 05 Aug, 2022 1 commit
    • 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
  11. 12 May, 2022 1 commit
  12. 12 Apr, 2022 1 commit
    • Nicolas Patry's avatar
      Change the chunk_iter function to handle (#16730) · a192f61e
      Nicolas Patry authored
      * Change the chunk_iter function to handle
      
      the subtle cases where the last chunk gets ignored since all the
      data is in the `left_strided` data.
      
      We need to remove the right striding on the previous item.
      
      * Remove commented line.
      a192f61e
  13. 02 Mar, 2022 1 commit
  14. 28 Feb, 2022 1 commit
  15. 25 Feb, 2022 1 commit
  16. 23 Feb, 2022 1 commit
  17. 15 Feb, 2022 2 commits
  18. 07 Feb, 2022 1 commit
  19. 02 Feb, 2022 1 commit
    • Nicolas Patry's avatar
      Adding support for `microphone` streaming within pipeline. (#15046) · 623d8cb4
      Nicolas Patry authored
      
      
      * Adding support for `microphone` streaming within pipeline.
      
      - Uses `ffmpeg` to get microphone data.
      - Makes sure alignment is made to `size_of_sample`.
      - Works by sending `{"raw": ..data.., "stride": (n, left, right),
      "partial": bool}`
      directly to the pipeline enabling to stream partial results and still
      get inference.
      - Let's `partial` information flow through the pipeline to enable caller
        to get it back and choose to display text or not.
      
      - The striding reconstitution is bound to have errors since CTC does not
      keep previous state. Currently most of the errors are we don't know if
      there's a space or not between two chunks.
      Since we have some left striding info, we could use that during decoding
      to choose what to do with those spaces and even extra letters maybe (if
      the stride is long enough, it's bound to cover at least a few symbols)
      
      Fixing tests.
      
      Protecting with `require_torch`.
      
      `raw_ctc` support for nicer demo.
      
      Post rebase fixes.
      
      Revamp to split raw_mic_data from it's live chunking.
      
      - Requires a refactor to make everything a bit cleaner.
      
      Automatic resampling.
      
      Small fix.
      
      Small fix.
      
      * Post rebase fix (need to let super handle more logic, reorder args.)
      
      * Update docstrings
      
      * Docstring format.
      
      * Remove print.
      
      * Prevent flow of `input_values`.
      
      * Fixing `stride` too.
      
      * Fixing the PR by removing `raw_ctc`.
      
      * Better docstrings.
      
      * Fixing init.
      
      * Update src/transformers/pipelines/audio_utils.py
      Co-authored-by: default avatarAnton Lozhkov <aglozhkov@gmail.com>
      
      * Update tests/test_pipelines_automatic_speech_recognition.py
      Co-authored-by: default avatarAnton Lozhkov <aglozhkov@gmail.com>
      
      * Quality.
      Co-authored-by: default avatarAnton Lozhkov <aglozhkov@gmail.com>
      623d8cb4
  20. 19 Jan, 2022 1 commit
  21. 18 Jan, 2022 2 commits
  22. 12 Jan, 2022 1 commit
  23. 04 Jan, 2022 1 commit
    • Nicolas Patry's avatar
      Hotfix `chunk_length_s` instead of `_ms`. (#15029) · 19d37c2d
      Nicolas Patry authored
      * Hotfix `chunk_length_s` instead of `_ms`.
      
      * Adding fix of `pad_token` which should be last/previous token for CTC
      
      proper decoding
      
      * Fixing ChunkPipeline unwrapping.
      
      * Adding a PackIterator specific test.
      19d37c2d
  24. 03 Jan, 2022 1 commit
  25. 30 Dec, 2021 1 commit
  26. 27 Dec, 2021 1 commit
    • Nicolas Patry's avatar
      ChunkPipeline (batch_size enabled on `zero-cls` and `qa` pipelines. (#14225) · b058490c
      Nicolas Patry authored
      
      
      * Pipeline chunks.
      
      * Batching for Chunking pipelines ?
      
      * Batching for `question-answering` and `zero-shot-cls`.
      
      * Fixing for FNet.
      
      * Making ASR a chunk pipeline.
      
      * Chunking ASR API.
      
      * doc style.
      
      * Fixing ASR test.
      
      * Fixing QA eror (p_mask, padding is 1, not 0).
      
      * Enable both vad and simple chunking.
      
      * Max length for vad.
      
      * remove inference mode, crashing on s2t.
      
      * Revert ChunkPipeline for ASRpipeline.
      
      Too many knobs for simple integration within the pipeline, better stick
      to external convenience functions instead, more control to be had,
      simpler pipeline and also easier to replace with other things later.
      
      * Drop necessity for PT for these.
      
      * Enabling generators.
      
      * Add mic + cleanup.
      
      * Typo.
      
      * Typo2.
      
      * Remove ASR work, it does not belong in this PR anymore.
      
      * Update src/transformers/pipelines/pt_utils.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Update src/transformers/pipelines/zero_shot_classification.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Adding many comments.
      
      * Doc quality.
      
      * `hidden_states` handling.
      
      * Adding doc.
      
      * Bad rebase.
      
      * Autofixing docs.
      
      * Fixing CRITICAL bug in the new Zerocls pipeline.
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      b058490c
  27. 16 Dec, 2021 1 commit
  28. 17 Nov, 2021 1 commit
  29. 29 Oct, 2021 1 commit
  30. 14 Oct, 2021 1 commit
  31. 21 Sep, 2021 2 commits
  32. 01 Sep, 2021 1 commit
  33. 07 Jul, 2021 1 commit
    • Nicolas Patry's avatar
      Adding support for `pipeline("automatic-speech-recognition")`. (#11525) · ebc69afc
      Nicolas Patry authored
      * Adding support for `pipeline("automatic-speech-recognition")`.
      
      - Ugly `"config"` choice for AutoModel. It would be great to have the
      possibility to have something like `AutoModelFor` that would implement
      the same logic (Load the config, check Architectures and load the first
      one)
      
      * Remove `model_id` was not needed in the end.
      
      * Rebased !
      
      * Remove old code.
      
      * Rename `nlp`.
      ebc69afc
  34. 30 Apr, 2021 1 commit
    • Nicolas Patry's avatar
      Adding `AutomaticSpeechRecognitionPipeline`. (#11337) · db9dd09c
      Nicolas Patry authored
      
      
      * Adding `AutomaticSpeechRecognitionPipeline`.
      
      - Because we added everything to enable this pipeline, we probably
      should add it to `transformers`.
      - This PR tries to limit the scope and focuses only on the pipeline part
      (what should go in, and out).
      - The tests are very specific for S2T and Wav2vec2 to make sure both
      architectures are supported by the pipeline. We don't use the mixin for
      tests right now, because that requires more work in the `pipeline`
      function (will be done in a follow up PR).
      - Unsure about the "helper" function `ffmpeg_read`. It makes a lot of
        sense from a user perspective, it does not add any additional
      dependencies (as in hard dependency, because users can always use their
      own load mechanism). Meanwhile, it feels slightly clunky to have so much
      optional preprocessing.
      - The pipeline is not done to support streaming audio right now.
      
      Future work:
      
      - Add `automatic-speech-recognition` as a `task`. And add the
      FeatureExtractor.from_pretrained within `pipeline` function.
      - Add small models within tests
      - Add the Mixin to tests.
      - Make the logic between ForCTC vs ForConditionalGeneration better.
      
      * Update tests/test_pipelines_automatic_speech_recognition.py
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      
      * Adding docs + main import + type checking + LICENSE.
      
      * Doc style !.
      
      * Fixing TYPE_HINT.
      
      * Specifying waveform shape in the docs.
      
      * Adding asserts + specify in the documentation the shape of the input
      np.ndarray.
      
      * Update src/transformers/pipelines/automatic_speech_recognition.py
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      
      * Adding require to tests + move the `feature_extractor` doc.
      Co-authored-by: default avatarLysandre Debut <lysandre@huggingface.co>
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      db9dd09c