Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional tasks via HuggingFace TaskManager #113

Closed
wants to merge 1 commit into from

Conversation

samruds
Copy link

@samruds samruds commented Feb 27, 2024

Issue #, if available:
#112

Description of changes:

  1. Check for os variable set with task
  2. Update error message to indicate using inference.py if Transformers Tasks or Architecture_2_Task do not support this task type

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Collaborator

@philschmid philschmid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimum tasks are not 100% related to Transformers tasks.

setup.py Outdated Show resolved Hide resolved
@samruds samruds force-pushed the PR branch 13 times, most recently from ad170f1 to 2689eb4 Compare March 4, 2024 22:50
@samruds samruds force-pushed the PR branch 26 times, most recently from 6a43011 to d6a9584 Compare March 7, 2024 09:41
Comment on lines +231 to +240
if "HF_TASK" in os.environ:
return os.environ["HF_TASK"]
else:
with open(model_config_path, "r") as config_file:
config = json.loads(config_file.read())
architecture = config.get("architectures", [None])[architecture_index]

for arch_options in ARCHITECTURES_2_TASK:
if architecture.endswith(arch_options):
task = ARCHITECTURES_2_TASK[arch_options]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change it is the exact same code as before, but you removed the error.

Copy link

@gwang111 gwang111 Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry Sam, I missed it. https://github.com/aws/sagemaker-huggingface-inference-toolkit/blame/80634b30703e8e9525db8b7128b05f713f42f9dc/src/sagemaker_huggingface_inference_toolkit/handler_service.py#L114 looks like the HF_TASK gets checked first before this function is even called.

Not sure why HF_TASK is being checked in this function then? Don't think we need to do anything. My bad

Please double check if i missed anything again

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep makes sense, I will close this issue.

@samruds samruds closed this Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants