Notebooks
L
LanceDB
Clip Text Image Search

Clip Text Image Search

agentsllmsvector-databaselancedbgptopenaiAImultimodal-aimachine-learningAccelerate-Vector-Search-Applications-Using-OpenVINOembeddingsfine-tuningexamplesdeep-learninggpt-4-visionllama-indexragmultimodallangchainlancedb-recipes

Text-to-Image and Image-to-image search Using CLIP and Comparitive Analysis

Install libraries

[1]
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: transformers in /home/prashant/.local/lib/python3.10/site-packages (4.34.1)
Requirement already satisfied: torch in /home/prashant/.local/lib/python3.10/site-packages (2.0.1)
Requirement already satisfied: datasets in /home/prashant/.local/lib/python3.10/site-packages (2.14.6)
Collecting gdcm
  Downloading gdcm-1.1-py3-none-manylinux1_x86_64.whl (2.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 MB 5.2 MB/s eta 0:00:00m eta 0:00:010:010m:04
Collecting pydicom
  Downloading pydicom-2.4.3-py3-none-any.whl (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 19.0 MB/s eta 0:00:0031m24.1 MB/s eta 0:00:01
Requirement already satisfied: lancedb in /home/prashant/.local/lib/python3.10/site-packages (0.3.3)
Requirement already satisfied: onnx in /home/prashant/.local/lib/python3.10/site-packages (1.14.1)
Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (0.17.3)
Requirement already satisfied: packaging>=20.0 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (23.2)
Requirement already satisfied: safetensors>=0.3.1 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (0.4.0)
Requirement already satisfied: tokenizers<0.15,>=0.14 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (0.14.1)
Requirement already satisfied: requests in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (2.31.0)
Requirement already satisfied: pyyaml>=5.1 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (6.0.1)
Requirement already satisfied: numpy>=1.17 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (1.26.1)
Requirement already satisfied: filelock in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (3.12.4)
Requirement already satisfied: regex!=2019.12.17 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (2023.10.3)
Requirement already satisfied: tqdm>=4.27 in /home/prashant/.local/lib/python3.10/site-packages (from transformers) (4.66.1)
Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.10.3.66)
Requirement already satisfied: nvidia-cusparse-cu11==11.7.4.91 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.7.4.91)
Requirement already satisfied: typing-extensions in /home/prashant/.local/lib/python3.10/site-packages (from torch) (4.8.0)
Requirement already satisfied: nvidia-nccl-cu11==2.14.3 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (2.14.3)
Requirement already satisfied: nvidia-curand-cu11==10.2.10.91 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (10.2.10.91)
Requirement already satisfied: nvidia-nvtx-cu11==11.7.91 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.7.91)
Requirement already satisfied: triton==2.0.0 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (2.0.0)
Requirement already satisfied: jinja2 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (3.1.2)
Requirement already satisfied: nvidia-cuda-cupti-cu11==11.7.101 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.7.101)
Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (10.9.0.58)
Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (8.5.0.96)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.7.99)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.7.99)
Requirement already satisfied: nvidia-cusolver-cu11==11.4.0.1 in /home/prashant/.local/lib/python3.10/site-packages (from torch) (11.4.0.1)
Requirement already satisfied: networkx in /home/prashant/.local/lib/python3.10/site-packages (from torch) (2.8.8)
Requirement already satisfied: sympy in /home/prashant/.local/lib/python3.10/site-packages (from torch) (1.12)
Requirement already satisfied: setuptools in /home/prashant/.local/lib/python3.10/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch) (68.2.2)
Requirement already satisfied: wheel in /usr/lib/python3/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch) (0.37.1)
Requirement already satisfied: lit in /home/prashant/.local/lib/python3.10/site-packages (from triton==2.0.0->torch) (17.0.5)
Requirement already satisfied: cmake in /home/prashant/.local/lib/python3.10/site-packages (from triton==2.0.0->torch) (3.27.7)
Requirement already satisfied: fsspec[http]<=2023.10.0,>=2023.1.0 in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (2023.6.0)
Requirement already satisfied: aiohttp in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (3.8.6)
Requirement already satisfied: pyarrow>=8.0.0 in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (13.0.0)
Requirement already satisfied: pandas in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (1.5.3)
Requirement already satisfied: xxhash in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (3.4.1)
Requirement already satisfied: multiprocess in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (0.70.15)
Requirement already satisfied: dill<0.3.8,>=0.3.0 in /home/prashant/.local/lib/python3.10/site-packages (from datasets) (0.3.7)
Requirement already satisfied: attrs>=21.3.0 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (23.1.0)
Requirement already satisfied: pylance==0.8.10 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (0.8.10)
Requirement already satisfied: retry>=0.9.2 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (0.9.2)
Requirement already satisfied: semver>=3.0 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (3.0.2)
Requirement already satisfied: deprecation in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (2.1.0)
Requirement already satisfied: cachetools in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (5.3.1)
Requirement already satisfied: ratelimiter~=1.0 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (1.2.0.post0)
Requirement already satisfied: pydantic>=1.10 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (1.10.13)
Requirement already satisfied: click>=8.1.7 in /home/prashant/.local/lib/python3.10/site-packages (from lancedb) (8.1.7)
Requirement already satisfied: protobuf>=3.20.2 in /home/prashant/.local/lib/python3.10/site-packages (from onnx) (4.21.2)
Requirement already satisfied: frozenlist>=1.1.1 in /home/prashant/.local/lib/python3.10/site-packages (from aiohttp->datasets) (1.4.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /home/prashant/.local/lib/python3.10/site-packages (from aiohttp->datasets) (1.9.2)
Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /home/prashant/.local/lib/python3.10/site-packages (from aiohttp->datasets) (3.3.0)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /home/prashant/.local/lib/python3.10/site-packages (from aiohttp->datasets) (4.0.3)
Requirement already satisfied: multidict<7.0,>=4.5 in /home/prashant/.local/lib/python3.10/site-packages (from aiohttp->datasets) (6.0.4)
Requirement already satisfied: aiosignal>=1.1.2 in /home/prashant/.local/lib/python3.10/site-packages (from aiohttp->datasets) (1.3.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests->transformers) (3.3)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/prashant/.local/lib/python3.10/site-packages (from requests->transformers) (1.26.18)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests->transformers) (2020.6.20)
Requirement already satisfied: decorator>=3.4.2 in /home/prashant/.local/lib/python3.10/site-packages (from retry>=0.9.2->lancedb) (4.4.2)
Requirement already satisfied: py<2.0.0,>=1.4.26 in /home/prashant/.local/lib/python3.10/site-packages (from retry>=0.9.2->lancedb) (1.11.0)
Requirement already satisfied: MarkupSafe>=2.0 in /home/prashant/.local/lib/python3.10/site-packages (from jinja2->torch) (2.1.3)
Requirement already satisfied: python-dateutil>=2.8.1 in /home/prashant/.local/lib/python3.10/site-packages (from pandas->datasets) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /home/prashant/.local/lib/python3.10/site-packages (from pandas->datasets) (2023.3.post1)
Requirement already satisfied: mpmath>=0.19 in /home/prashant/.local/lib/python3.10/site-packages (from sympy->torch) (1.3.0)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.8.1->pandas->datasets) (1.16.0)
Installing collected packages: gdcm, pydicom
Successfully installed gdcm-1.1 pydicom-2.4.3

Import libraries

[2]
/usr/lib/python3/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,

Load Dataset

[3]
Downloading data files:   0%|          | 0/2 [00:00<?, ?it/s]
Downloading data:   0%|          | 0.00/565M [00:00<?, ?B/s]
Downloading data:   0%|          | 0.00/2.60M [00:00<?, ?B/s]
Generating train split:   0%|          | 0/3318333 [00:00<?, ? examples/s]
Generating validation split:   0%|          | 0/15840 [00:00<?, ? examples/s]
[4]
Dataset({
,    features: ['image_url', 'caption'],
,    num_rows: 3318333
,})

We will select a sample of 100 images from this large number of images

[5]
[6]
(100, 2)
[7]
[8]
[9]
[10]
[11]
[12]
/home/prashant/.local/lib/python3.10/site-packages/PIL/Image.py:970: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images
  warnings.warn(
[13]
Output

CLIP using Hugging Face

[14]
[15]
[61]

Create Embeddings using Hugging face model

Helper functions to extract Text Embeddings

[27]
[28]
[29]

Helper functions to extract Image Embeddings

[30]

Get the embedding of all the images

[31]

Helper function for showing images

[32]

Connect LanceDB

[23]

Extracting Embeddings of 100 images from Hugging Face model

[60]
Time Taken to extract Embeddings of 83 Images(in seconds):  55.79400444030762
[34]

Database Insert

[35]
[36]
[2023-12-09T16:50:42Z WARN  lance::dataset] No existing dataset at /home/prashant/Downloads/clip/.lancedb/pt_table.lance, it will be created

Start the query

Text to image

[37]
[38]

Image to image

[39]
Output
[41]
Time taken to Extract Img embeddings and searching for 83 images is  55.26035737991333

CLIP using OpenVINO

[42]
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
embedchain 0.0.70 requires langchain<0.0.280,>=0.0.279, but you have langchain 0.0.335 which is incompatible.
embedchain 0.0.70 requires openai<0.28.0,>=0.27.5, but you have openai 0.28.1 which is incompatible.
embedchain 0.0.70 requires tiktoken<0.5.0,>=0.4.0, but you have tiktoken 0.5.1 which is incompatible.
poetry 1.1.12 requires packaging<21.0,>=20.4, but you have packaging 23.2 which is incompatible.
[43]
[44]
/home/prashant/.local/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py:287: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if attn_weights.size() != (bsz * self.num_heads, tgt_len, src_len):
/home/prashant/.local/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py:327: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if attn_output.size() != (bsz * self.num_heads, tgt_len, self.head_dim):
/home/prashant/.local/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py:295: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if causal_attention_mask.size() != (bsz, 1, tgt_len, src_len):
/home/prashant/.local/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py:304: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if attention_mask.size() != (bsz, 1, tgt_len, src_len):
[73]
[74]
[75]
Time Taken to extract Embeddings of 83 Images(in seconds):  31.79015016555786

Database Insert

[51]
[52]
[2023-12-09T17:01:26Z WARN  lance::dataset] No existing dataset at /home/prashant/Downloads/clip/.lancedb/ov_tbl.lance, it will be created
[53]
[54]
Output

Post Training Optimization (NNCF Quantization) using OpenVINO

Converting CLIP into INT8 format in OpenVINO

[55]
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
Note: you may need to restart the kernel to use updated packages.
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
nemo-toolkit 1.20.0 requires numpy<1.24,>=1.22, but you have numpy 1.26.1 which is incompatible.
nemo-toolkit 1.20.0 requires setuptools==65.5.1, but you have setuptools 68.2.2 which is incompatible.
Note: you may need to restart the kernel to use updated packages.
[56]
[65]
[66]
[67]
[68]
INFO:nncf:NNCF initialized successfully. Supported frameworks detected: torch, onnx, openvino
Fetching 300 for the initialization...
0it [00:00, ?it/s]
[69]
Output()
Output()
Output()
Output()
Output()
Output()

Run Quantized Model

[71]
[72]
Time Taken to extract Embeddings of 83 Images(in seconds):  13.70863938331604
[76]
[2023-12-09T17:38:30Z WARN  lance::dataset] No existing dataset at /home/prashant/Downloads/clip/.lancedb/qov_tbl.lance, it will be created
[78]
[79]
Performance speed up using FP16 format: 1.738
Performance speed up using Int8 format: 4.034
[80]
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3575.295
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 0
cpu cores	: 8
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3668.826
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 0
cpu cores	: 8
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3683.012
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 4
cpu cores	: 8
apicid		: 8
initial apicid	: 8
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3111.338
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 4
cpu cores	: 8
apicid		: 9
initial apicid	: 9
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 4
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3355.465
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 8
cpu cores	: 8
apicid		: 16
initial apicid	: 16
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 5
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 2919.099
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 8
cpu cores	: 8
apicid		: 17
initial apicid	: 17
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 6
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3378.997
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 12
cpu cores	: 8
apicid		: 24
initial apicid	: 24
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 3319.172
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 12
cpu cores	: 8
apicid		: 25
initial apicid	: 25
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 8
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 2466.248
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 16
cpu cores	: 8
apicid		: 32
initial apicid	: 32
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 9
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 2477.316
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 17
cpu cores	: 8
apicid		: 34
initial apicid	: 34
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 10
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 2466.492
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 18
cpu cores	: 8
apicid		: 36
initial apicid	: 36
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 11
vendor_id	: GenuineIntel
cpu family	: 6
model		: 186
model name	: 13th Gen Intel(R) Core(TM) i5-13420H
stepping	: 2
microcode	: 0x411c
cpu MHz		: 2456.223
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 19
cpu cores	: 8
apicid		: 38
initial apicid	: 38
fpu		: yes
fpu_exception	: yes
cpuid level	: 32
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
vmx flags	: vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb
bogomips	: 5222.40
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
[81]
MemTotal:        7819972 kB
MemFree:          324644 kB
MemAvailable:     956452 kB
Buffers:           13388 kB
Cached:          1245868 kB
SwapCached:       499612 kB
Active:          2018208 kB
Inactive:        4327040 kB
Active(anon):    1611340 kB
Inactive(anon):  4040560 kB
Active(file):     406868 kB
Inactive(file):   286480 kB
Unevictable:       84564 kB
Mlocked:              48 kB
SwapTotal:      20824060 kB
SwapFree:       10418076 kB
Zswap:                 0 kB
Zswapped:              0 kB
Dirty:               388 kB
Writeback:            12 kB
AnonPages:       4989488 kB
Mapped:           631844 kB
Shmem:            565908 kB
KReclaimable:     251608 kB
Slab:             537912 kB
SReclaimable:     251608 kB
SUnreclaim:       286304 kB
KernelStack:       32112 kB
PageTables:       111640 kB
SecPageTables:         0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    24734044 kB
Committed_AS:   32765328 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      157808 kB
VmallocChunk:          0 kB
Percpu:            15424 kB
HardwareCorrupted:     0 kB
AnonHugePages:    108544 kB
ShmemHugePages:    88064 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:     6904064 kB
DirectMap2M:     1181696 kB
DirectMap1G:           0 kB
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)

Conclusion

All these results are on CPU for comparison of Pytorch model with Openvino format model

Time Taken to extract 100 Images Embeddings using CLIP using

  1. Pytorch model from Hugging Face - 55.26 seconds
  2. Openvino FP16 format - 31.79 seconds
  3. Openvino Int8 format - 13.70 seconds

Performance speed up using FP16 model is 1.73 times which is not much acceleration compared to speed.

But on the otherside when we see INT8 openvino format, it speeds up by 4.03 times compared to Pytorch model.