Spaces:
Build error
Build error
Download diffusers_helper/clip_vision.py from Amarble1208/FramePack: direct link, hf CLI and curl.
- Browser
- Download file 461 Bytes
-
https://huggingface.co/spaces/Amarble1208/FramePack/resolve/main/diffusers_helper/clip_vision.py
- Command line
-
hf download hf://spaces/Amarble1208/FramePack/diffusers_helper/clip_vision.py
-
curl -L -o clip_vision.py https://huggingface.co/spaces/Amarble1208/FramePack/resolve/main/diffusers_helper/clip_vision.py
461 Bytes
| import numpy as np | |
| def hf_clip_vision_encode(image, feature_extractor, image_encoder): | |
| assert isinstance(image, np.ndarray) | |
| assert image.ndim == 3 and image.shape[2] == 3 | |
| assert image.dtype == np.uint8 | |
| preprocessed = feature_extractor.preprocess(images=image, return_tensors="pt").to(device=image_encoder.device, dtype=image_encoder.dtype) | |
| image_encoder_output = image_encoder(**preprocessed) | |
| return image_encoder_output | |