error when deploying to huggingface inference endpoint

#17
by maazmehmood22 - opened

Hello I get an error when I try to deploy this model to HF inference endpoint, the GPU used was a NVIDIA A10G
here are the logs:

f69dd45546p69p 2023-08-14T12:59:16.442Z  INFO | Ignore regex pattern for files, which are not downloaded: tf*, flax*, rust*, *onnx, *safetensors, *mlmodel, *tflite, *tar.gz, *ckpt
f69dd45546p69p 2023-08-14T12:59:16.442Z  INFO | Start loading image artifacts from huggingface.co
f69dd45546p69p 2023-08-14T12:59:16.442Z  INFO | Used configuration:
f69dd45546p69p 2023-08-14T12:59:16.442Z  INFO | Repository ID: stabilityai/stable-diffusion-xl-refiner-1.0
f69dd45546p69p 2023-08-14T12:59:16.442Z  INFO | Repository Revision: 93b080bbdc8efbeb862e29e15316cff53f9bef86
f69dd45546p69p 2023-08-14T12:59:22.261Z 2023-08-14 12:59:22,261 | INFO | No custom pipeline found at /repository/handler.py
f69dd45546p69p 2023-08-14T12:59:22.261Z 2023-08-14 12:59:22,261 | INFO | Using device GPU
f69dd45546p69p 2023-08-14T12:59:22.261Z 2023-08-14 12:59:22,261 | INFO | Initializing model from directory:/repository
f69dd45546p69p 2023-08-14T12:59:22.302Z 
Loading pipeline components...:   0%|          | 0/5 [00:00<?, ?it/s]
Loading pipeline components...:  20%|██        | 1/5 [00:00<00:00, 25.04it/s]
f69dd45546p69p 2023-08-14T12:59:22.305Z Application startup failed. Exiting.
f69dd45546p69p 2023-08-14T12:59:22.305Z     model_file = _get_model_file(
f69dd45546p69p 2023-08-14T12:59:22.305Z     self.pipeline = get_pipeline(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T12:59:22.305Z     loaded_sub_model = load_sub_model(
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 682, in startup
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 584, in __aenter__
f69dd45546p69p 2023-08-14T12:59:22.305Z 
f69dd45546p69p 2023-08-14T12:59:22.305Z     self.pipeline = AutoPipelineForText2Image.from_pretrained(model_dir, torch_dtype=dtype, device_map=device_map)
f69dd45546p69p 2023-08-14T12:59:22.305Z     await self._router.startup()
f69dd45546p69p 2023-08-14T12:59:22.305Z     raise EnvironmentError(
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 468, in load_sub_model
f69dd45546p69p 2023-08-14T12:59:22.305Z     hf_pipeline = get_diffusers_pipeline(task=task, model_dir=model_dir, device=device, **kwargs)
f69dd45546p69p 2023-08-14T12:59:22.305Z     await handler()
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 26, in __init__
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/utils/hub_utils.py", line 275, in _get_model_file
f69dd45546p69p 2023-08-14T12:59:22.305Z     pipeline = DIFFUSERS_TASKS[task](model_dir=model_dir, device=device)
f69dd45546p69p 2023-08-14T12:59:22.305Z     loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/app/webservice_starlette.py", line 57, in some_startup_task
f69dd45546p69p 2023-08-14T12:59:22.305Z     return HuggingFaceHandler(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/app/huggingface_inference_toolkit/handler.py", line 45, in get_inference_handler_either_custom_or_default_handler
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 705, in lifespan
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/auto_pipeline.py", line 311, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:22.305Z     async with self.lifespan_context(app) as maybe_state:
f69dd45546p69p 2023-08-14T12:59:22.305Z Traceback (most recent call last):
f69dd45546p69p 2023-08-14T12:59:22.305Z OSError: Error no file named diffusion_pytorch_model.bin found in directory /repository/vae.
f69dd45546p69p 2023-08-14T12:59:22.305Z     return text_2_image_cls.from_pretrained(pretrained_model_or_path, **kwargs)
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 62, in get_diffusers_pipeline
f69dd45546p69p 2023-08-14T12:59:22.305Z     inference_handler = get_inference_handler_either_custom_or_default_handler(HF_MODEL_DIR, task=HF_TASK)
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/models/modeling_utils.py", line 576, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/app/huggingface_inference_toolkit/utils.py", line 259, in get_pipeline
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/app/huggingface_inference_toolkit/handler.py", line 17, in __init__
f69dd45546p69p 2023-08-14T12:59:22.305Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 1069, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:25.306Z 2023-08-14 12:59:25,306 | INFO | Initializing model from directory:/repository
f69dd45546p69p 2023-08-14T12:59:25.306Z 2023-08-14 12:59:25,306 | INFO | No custom pipeline found at /repository/handler.py
f69dd45546p69p 2023-08-14T12:59:25.306Z 2023-08-14 12:59:25,306 | INFO | Using device GPU
f69dd45546p69p 2023-08-14T12:59:25.307Z 
Loading pipeline components...:   0%|          | 0/5 [00:00<?, ?it/s]
Loading pipeline components...:   0%|          | 0/5 [00:00<?, ?it/s]
f69dd45546p69p 2023-08-14T12:59:25.308Z     async with self.lifespan_context(app) as maybe_state:
f69dd45546p69p 2023-08-14T12:59:25.308Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 682, in startup
f69dd45546p69p 2023-08-14T12:59:25.308Z Traceback (most recent call last):
f69dd45546p69p 2023-08-14T12:59:25.308Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 705, in lifespan
f69dd45546p69p 2023-08-14T12:59:25.308Z     return HuggingFaceHandler(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T12:59:25.308Z     inference_handler = get_inference_handler_either_custom_or_default_handler(HF_MODEL_DIR, task=HF_TASK)
f69dd45546p69p 2023-08-14T12:59:25.308Z   File "/app/huggingface_inference_toolkit/handler.py", line 45, in get_inference_handler_either_custom_or_default_handler
f69dd45546p69p 2023-08-14T12:59:25.308Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 584, in __aenter__
f69dd45546p69p 2023-08-14T12:59:25.308Z     await self._router.startup()
f69dd45546p69p 2023-08-14T12:59:25.308Z   File "/app/webservice_starlette.py", line 57, in some_startup_task
f69dd45546p69p 2023-08-14T12:59:25.308Z     await handler()
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/utils/hub_utils.py", line 275, in _get_model_file
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/app/huggingface_inference_toolkit/utils.py", line 259, in get_pipeline
f69dd45546p69p 2023-08-14T12:59:25.309Z Application startup failed. Exiting.
f69dd45546p69p 2023-08-14T12:59:25.309Z     raise EnvironmentError(
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 62, in get_diffusers_pipeline
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/models/modeling_utils.py", line 576, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 1069, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/app/huggingface_inference_toolkit/handler.py", line 17, in __init__
f69dd45546p69p 2023-08-14T12:59:25.309Z     pipeline = DIFFUSERS_TASKS[task](model_dir=model_dir, device=device)
f69dd45546p69p 2023-08-14T12:59:25.309Z     self.pipeline = get_pipeline(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T12:59:25.309Z     model_file = _get_model_file(
f69dd45546p69p 2023-08-14T12:59:25.309Z     loaded_sub_model = load_sub_model(
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/auto_pipeline.py", line 311, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 26, in __init__
f69dd45546p69p 2023-08-14T12:59:25.309Z 
f69dd45546p69p 2023-08-14T12:59:25.309Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 468, in load_sub_model
f69dd45546p69p 2023-08-14T12:59:25.309Z     return text_2_image_cls.from_pretrained(pretrained_model_or_path, **kwargs)
f69dd45546p69p 2023-08-14T12:59:25.309Z     self.pipeline = AutoPipelineForText2Image.from_pretrained(model_dir, torch_dtype=dtype, device_map=device_map)
f69dd45546p69p 2023-08-14T12:59:25.309Z     loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
f69dd45546p69p 2023-08-14T12:59:25.309Z     hf_pipeline = get_diffusers_pipeline(task=task, model_dir=model_dir, device=device, **kwargs)
f69dd45546p69p 2023-08-14T12:59:25.309Z OSError: Error no file named diffusion_pytorch_model.bin found in directory /repository/unet.
f69dd45546p69p 2023-08-14T12:59:42.845Z 2023-08-14 12:59:42,845 | INFO | Initializing model from directory:/repository
f69dd45546p69p 2023-08-14T12:59:42.845Z 2023-08-14 12:59:42,845 | INFO | No custom pipeline found at /repository/handler.py
f69dd45546p69p 2023-08-14T12:59:42.845Z 2023-08-14 12:59:42,845 | INFO | Using device GPU
f69dd45546p69p 2023-08-14T12:59:42.900Z 
Loading pipeline components...:   0%|          | 0/5 [00:00<?, ?it/s]
Loading pipeline components...:  20%|██        | 1/5 [00:00<00:00, 18.51it/s]
f69dd45546p69p 2023-08-14T12:59:42.902Z 
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2474, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:42.902Z     return text_2_image_cls.from_pretrained(pretrained_model_or_path, **kwargs)
f69dd45546p69p 2023-08-14T12:59:42.902Z     self.pipeline = AutoPipelineForText2Image.from_pretrained(model_dir, torch_dtype=dtype, device_map=device_map)
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 62, in get_diffusers_pipeline
f69dd45546p69p 2023-08-14T12:59:42.902Z     self.pipeline = get_pipeline(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/app/webservice_starlette.py", line 57, in some_startup_task
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 705, in lifespan
f69dd45546p69p 2023-08-14T12:59:42.902Z     raise EnvironmentError(
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 26, in __init__
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/app/huggingface_inference_toolkit/utils.py", line 259, in get_pipeline
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/app/huggingface_inference_toolkit/handler.py", line 45, in get_inference_handler_either_custom_or_default_handler
f69dd45546p69p 2023-08-14T12:59:42.902Z     await handler()
f69dd45546p69p 2023-08-14T12:59:42.902Z Traceback (most recent call last):
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 1069, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/auto_pipeline.py", line 311, in from_pretrained
f69dd45546p69p 2023-08-14T12:59:42.902Z     pipeline = DIFFUSERS_TASKS[task](model_dir=model_dir, device=device)
f69dd45546p69p 2023-08-14T12:59:42.902Z     hf_pipeline = get_diffusers_pipeline(task=task, model_dir=model_dir, device=device, **kwargs)
f69dd45546p69p 2023-08-14T12:59:42.902Z     return HuggingFaceHandler(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T12:59:42.902Z     inference_handler = get_inference_handler_either_custom_or_default_handler(HF_MODEL_DIR, task=HF_TASK)
f69dd45546p69p 2023-08-14T12:59:42.902Z     await self._router.startup()
f69dd45546p69p 2023-08-14T12:59:42.902Z OSError: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory /repository/text_encoder_2.
f69dd45546p69p 2023-08-14T12:59:42.902Z     loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 468, in load_sub_model
f69dd45546p69p 2023-08-14T12:59:42.902Z     loaded_sub_model = load_sub_model(
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/app/huggingface_inference_toolkit/handler.py", line 17, in __init__
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 682, in startup
f69dd45546p69p 2023-08-14T12:59:42.902Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 584, in __aenter__
f69dd45546p69p 2023-08-14T12:59:42.902Z     async with self.lifespan_context(app) as maybe_state:
f69dd45546p69p 2023-08-14T12:59:42.905Z Application startup failed. Exiting.
f69dd45546p69p 2023-08-14T13:00:09.893Z 2023-08-14 13:00:09,893 | INFO | No custom pipeline found at /repository/handler.py
f69dd45546p69p 2023-08-14T13:00:09.893Z 2023-08-14 13:00:09,893 | INFO | Initializing model from directory:/repository
f69dd45546p69p 2023-08-14T13:00:09.893Z 2023-08-14 13:00:09,893 | INFO | Using device GPU
f69dd45546p69p 2023-08-14T13:00:09.944Z 
Loading pipeline components...:   0%|          | 0/5 [00:00<?, ?it/s]
Loading pipeline components...:  20%|██        | 1/5 [00:00<00:00, 20.27it/s]
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 468, in load_sub_model
f69dd45546p69p 2023-08-14T13:00:09.945Z     loaded_sub_model = load_sub_model(
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/auto_pipeline.py", line 311, in from_pretrained
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 62, in get_diffusers_pipeline
f69dd45546p69p 2023-08-14T13:00:09.945Z     hf_pipeline = get_diffusers_pipeline(task=task, model_dir=model_dir, device=device, **kwargs)
f69dd45546p69p 2023-08-14T13:00:09.945Z     inference_handler = get_inference_handler_either_custom_or_default_handler(HF_MODEL_DIR, task=HF_TASK)
f69dd45546p69p 2023-08-14T13:00:09.945Z     await self._router.startup()
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/utils/hub_utils.py", line 275, in _get_model_file
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/models/modeling_utils.py", line 576, in from_pretrained
f69dd45546p69p 2023-08-14T13:00:09.945Z     return text_2_image_cls.from_pretrained(pretrained_model_or_path, **kwargs)
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/app/huggingface_inference_toolkit/utils.py", line 259, in get_pipeline
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/app/huggingface_inference_toolkit/handler.py", line 17, in __init__
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/app/huggingface_inference_toolkit/handler.py", line 45, in get_inference_handler_either_custom_or_default_handler
f69dd45546p69p 2023-08-14T13:00:09.945Z     async with self.lifespan_context(app) as maybe_state:
f69dd45546p69p 2023-08-14T13:00:09.945Z     model_file = _get_model_file(
f69dd45546p69p 2023-08-14T13:00:09.945Z     loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/app/huggingface_inference_toolkit/diffusers_utils.py", line 26, in __init__
f69dd45546p69p 2023-08-14T13:00:09.945Z     pipeline = DIFFUSERS_TASKS[task](model_dir=model_dir, device=device)
f69dd45546p69p 2023-08-14T13:00:09.945Z     self.pipeline = get_pipeline(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T13:00:09.945Z     await handler()
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 682, in startup
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 584, in __aenter__
f69dd45546p69p 2023-08-14T13:00:09.945Z Traceback (most recent call last):
f69dd45546p69p 2023-08-14T13:00:09.945Z 
f69dd45546p69p 2023-08-14T13:00:09.945Z OSError: Error no file named diffusion_pytorch_model.bin found in directory /repository/vae.
f69dd45546p69p 2023-08-14T13:00:09.945Z     raise EnvironmentError(
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py", line 1069, in from_pretrained
f69dd45546p69p 2023-08-14T13:00:09.945Z     self.pipeline = AutoPipelineForText2Image.from_pretrained(model_dir, torch_dtype=dtype, device_map=device_map)
f69dd45546p69p 2023-08-14T13:00:09.945Z     return HuggingFaceHandler(model_dir=model_dir, task=task)
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/app/webservice_starlette.py", line 57, in some_startup_task
f69dd45546p69p 2023-08-14T13:00:09.945Z   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 705, in lifespan
f69dd45546p69p 2023-08-14T13:00:09.948Z Application startup failed. Exiting.

Have the same error when deploying to Sagemaker

Error no file named pytorch_model.bin, tf_model.h5

@maazmehmood22 hello, have you successfully infer endpoint?

Sign up or log in to comment