openvino_notebooks: [235-controlnet] Fail to prepare calibration datasets

Describe the bug Section: Prepare calibration datasets Code block:

import datasets

num_inference_steps = 20
subset_size = 200

dataset = datasets.load_dataset("jschoormans/humanpose_densepose", split="train", streaming=True).shuffle(seed=42)
input_data = []
for batch in dataset:
    caption = batch["caption"]
    if len(caption) > tokenizer.model_max_length:
        continue
    img = batch["file_name"]
    input_data.append((caption, pose_estimator(img)))
    if len(input_data) >= subset_size // num_inference_steps:
        break

Error output:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[32], line 15
     13     continue
     14 img = batch["file_name"]
---> 15 input_data.append((caption, pose_estimator(img)))
     16 if len(input_data) >= subset_size // num_inference_steps:
     17     break

File /opt/conda/lib/python3.10/site-packages/controlnet_aux/open_pose/__init__.py:214, in OpenposeDetector.__call__(self, input_image, detect_resolution, image_resolution, include_body, include_hand, include_face, hand_and_face, output_type, **kwargs)
    211         output_type = "pil"
    213 if not isinstance(input_image, np.ndarray):
--> 214     input_image = np.array(input_image, dtype=np.uint8)
    216 input_image = HWC3(input_image)
    217 input_image = resize_image(input_image, detect_resolution)

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'dict'

Installation instructions (Please mark the checkbox) [*] I followed the installation guide at https://github.com/openvinotoolkit/openvino_notebooks#-installation-guide to install the notebooks. I run the notebook on Kaggle.

Additional context Also, on Kaggle the %load_ext skip_kernel_extension fails to be executed, so I had to delete this line and all the lines to skip cells if not checked.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

@l-bat

I tried to use another Machine type on Google Cloud: before I was using e2-highmem-8 but after I changed to n2-highmem-8 it all worked. Also, I used the last version of the tutorial Notebook.

@l-bat Can you check, please?