-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
HuggingFaceProcessor with ProcessingStep results in import errors (similar to issues/2656) #4802
Comments
Hi @solanki-ravi , thanks for reaching out! Given this job logs:
The Could you check your script to see what commands are used in line 2-8 in |
Thanks @qidewenwhen. evaluate.py and path invocation script is inline here. --- evaluate.py---
and invocation code:
|
In order to make troubleshooting simple, I created this Notebook (attached) that results in the same error (no dependency on my code). @qidewenwhen evaluate.py
output logs:
|
Hi @solanki-ravi , sorry for the long delay. Did not receive notification. And thanks so much for the reproduce notebook, which is very helpful! Given the error, seems the evaluate.py is being interpreted as a shell script rather than a python script. I checked the pipeline definition in the notebook.
The
|
I looked into the Processor code and found that the HuggingFaceProcessor extends the FrameworkProcessor, which hard-codes the entrypoint command to be sagemaker-python-sdk/src/sagemaker/processing.py Lines 1422 to 1425 in 1e679b4
In the _set_entrypoint method, the bash command is used and it also mentions that the user input sagemaker-python-sdk/src/sagemaker/processing.py Lines 1998 to 2011 in 1e679b4
Given the above, seems the framework containers including HuggingFace expects bash scripts only. As my team does not own these processors, will need the corresponding team for further assistance if you hope to expand the usage for python code. |
Describe the bug
Using the HuggingFaceProcessor with ProcessingStep results in import errors similar to: #2656
2024-07-25T15:47:57.615Z | /opt/ml/processing/input/entrypoint/evaluate.py: line 2: SAGEMAKER_INPUTS_DIR: command not found
2024-07-25T15:47:57.615Z | /opt/ml/processing/input/entrypoint/evaluate.py: line 3: SAGEMAKER_OUTPUTS_DIR: command not found
2024-07-25T15:47:57.615Z | /opt/ml/processing/input/entrypoint/evaluate.py: line 5: import: command not found
2024-07-25T15:47:57.615Z | /opt/ml/processing/input/entrypoint/evaluate.py: line 6: import: command not found
2024-07-25T15:47:57.615Z | /opt/ml/processing/input/entrypoint/evaluate.py: line 7: import: command not found
2024-07-25T15:47:57.616Z | /opt/ml/processing/input/entrypoint/evaluate.py: line 8: import: command not found
...
To reproduce
Define the HuggingFace processor
huggingface_processor = HuggingFaceProcessor(
role=role,
transformers_version='4.4',
pytorch_version='1.6.0',
instance_count=1,
instance_type=f'{SAGEMAKER_GPU_INSTANCE_TYPE}',
command=["python3"]
)
step_evaluate = ProcessingStep(
name="...",
processor=huggingface_processor,
inputs=[
...
],
outputs=[
...
],
code="src/evaluate.py"
)
pipeline = Pipeline(
name="...",
steps=[ step_evaluate]
)
Execute the pipeline
pipeline.upsert(role_arn=role)
execution = pipeline.start()
execution.wait()
Expected behavior
Error should not happen, and evalute.py should be invoked by the container.
Screenshots or logs
Attached
System information
A description of your system. Please provide:
$ pip show sagemaker
Name: sagemaker
Version: 2.226.1
$ pip show transformers
Name: transformers
Version: 4.42.4
$ pip show torch
Name: torch
Version: 2.1.2
log-events-viewer-result.csv
Additional context
related? #2656
The text was updated successfully, but these errors were encountered: