aws / aws/sagemaker-huggingface-inference-toolkit
get_pipeline function passes Path object rather than PretrainedTokenizer
- Dominant language
- Python
- Stars
- 270
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
When using certain pipeline tasks (e.g., "image-to-text") the get_pipeline function passes in `model_dir` as the tokenizer ink wargs. However, the Pipeline class expects a [PretrainedTokenizer](https://github.com/huggingface/transformers/blob/bffac926ca6bc6c965a92bfbfd00c567a2c0fb90/src/transformers/pipelines/base.py#L763) object instead. Because `model_dir` is being passed, when the [tokenizer is decoded](https://github.com/huggingface/transformers/blob/bffac926ca6bc6c965a92bfbfd00c567a2c0fb90/src/transformers/pipelines/image_to_text.py#L176) in the subclass it gives the error `"message": "str object has no attribute decode"`.
This should be changed so that this function is using the proper tokenizer for the task.
Contributor guide
Research direction
Start at the get_pipeline entry point and trace how model_dir is passed into tokenizer kwargs. Compare the expected tokenizer in transformers' pipelines/base.py with decoding in pipelines/image_to_text.py, then verify that image-to-text uses a proper tokenizer and no longer raises the reported decode error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100