Compare fixed CLIP image/text inputs on a research CPU desktop
Reproduce a private, fixed-input ViT-B/32 research check with OpenAI’s native CLIP code, checkpoint, BPE vocabulary and publisher diagram fixture. Compare three fixed English labels through normalized 512-dimensional embeddings and similarity logits. The native text limit is 77 tokens per label, including start/end tokens. This educational loopback prototype is not a production service or calibrated classifier; publisher model card places any deployed use outside scope. Fit and performance are unmeasured.
- Hardware
- Intel Core i5-12400 desktop, 4 inference threads, 32 GiB RAM
- Runtime
- Native OpenAI CLIP CPU paired-input private research wrapper OpenAI CLIP d05afc436d78f1c48dc0dbf8e5980a9d471f35f6; torch 2.6.0+cpu; torchvision 0.21.0+cpu; Python 3.12 · CPU
- Model format
- PyTorch JIT checkpoint · Native CPU float32 eager model loaded with jit=False · No quantization; native eager CPU load converts model to float32
- Workload
- 77 token context · 1 concurrent
Based on source documentation; this setup has not been executed by OpenTools. Memory: unknown. No compatible measurement available.
Read the complete setup guide
Before you start
- Use an owned Intel Core i5-12400 desktop with Ubuntu 24.04 x86_64, 32 GiB installed RAM and 40 GiB free disk. Allocate four inference threads and build natively on the same host.
- Experimental private research only. The native model card places any deployed use outside scope; this educational loopback wrapper is a reproducible test harness, not production-safe hosting or a calibrated classifier. Do not use scores for automatic or consequential decisions.
- Use only the exact publisher architecture diagram fixture and fixed English labels a diagram / a dog / a cat. No uploads, arbitrary URLs or user-defined taxonomy are accepted. Confirm the intended use and retain MIT notices.
- 32 GiB RAM, 40 GiB disk and four threads are planning allocations, not measured fit. The chosen ViT-B/32 is one of nine native released variants; the other eight and broader workflows remain unqualified.
Exact model and requirements
- Artifact:
- OpenAI / CLIP ViT-B/32 native checkpoint (representative family variant) · checkpoint openai/CLIP ViT-B/32
- Publisher revision:
- d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- Artifact digest:
- sha256:40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af
- Download size:
- 0.33 GiB
- Memory requirement (unknown):
- Unknown — No exact full-process peak for native CLIP ViT-B/32 CPU float32, image/text encoders, preprocessing and wrapper.
- System RAM / disk:
- Unknown / Unknown
- Placement:
- single device. One CPU host; no tensor/pipeline sharding. Entire model on CPU; no device_map, GPU or disk offload.
- KV cache:
- Non-autoregressive paired encoders; no chat/generation K/V cache is configured.
- Workload:
- 77 token context; Unknown; Not applicable; concurrency 1; batch 1; cache unknown; repetitions Unknown.
- Tokenizer:
- Native CLIP SimpleTokenizer and exact bpe_simple_vocab_16e6.txt.gz · d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- Sampling / reasoning:
- No text sampling. Three fixed labels: a diagram, a dog, a cat; fixed publisher CLIP.png. Native resize/center crop to 224 RGB and normalization; image batch 1, text batch 3 padded to 77. No silent truncation. No chat, reasoning, instruction template, text generation or tool execution. Embeddings are normalized before cosine similarity; logits use native learned logit_scale. Relative label scores are not calibrated probabilities or universal truth.
- Runtime prerequisites:
- Ubuntu 24.04 x86_64; See prerequisites above.
Native OpenAI CLIP repository MIT license and OpenAI-owned ViT-B/32 card MIT declaration are archived; retain copyright/license notices. Native model card recommends research and identifies any deployed use as out of scope. This fixed-input private educational experiment does not establish deployment suitability, safety, fairness, calibration or legal clearance. Inputs/labels are English; no automatic decisions or consequential classification.
- Native BPE vocabulary packaged with pinned runtime · 0 GiB · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- Publisher CLIP.png research diagram fixture · 0 GiB · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- 353,976,522 bytes is publisher expected checkpoint content length from HEAD metadata, not a downloaded weight-body measurement or full runtime RAM requirement.
- 32 GiB RAM, 40 GiB disk and four threads are author planning allocations, not measured minima. Both encoders, preprocessing, buffers, dependencies and OS add memory/storage.
One-time setup and hardware
- hardware
- Unknown — Existing desktop purchase price and incremental hardware cost depend on the reader; unknown.
- Existing desktop purchase price and incremental hardware cost depend on the reader; unknown. Tax: unknown.
- setup
- Unknown — Initial provisioning/build time and labor cost are unknown.
- Initial provisioning/build time and labor cost are unknown. Tax: unknown.
Recurring costs
- electricity
- Unknown — Actual wall power, electricity rate and powered hours are unknown; no TDP-to-wall-power conversion.
- Actual wall power, electricity rate and powered hours are unknown; no TDP-to-wall-power conversion. Tax: unknown.
- storage
- Unknown — Incremental cost of local disk capacity is unknown. The 40 GiB free-disk walkthrough allocation is an author choice, not a measured requirement.
- Incremental cost of local disk capacity is unknown. The 40 GiB free-disk walkthrough allocation is an author choice, not a measured requirement. Tax: unknown.
- egress
- Unknown — Data transfer price, allowances and traffic volume are unknown.
- Data transfer price, allowances and traffic volume are unknown. Tax: unknown.
- administration
- Unknown — Maintenance labor rate and hours are unknown.
- Maintenance labor rate and hours are unknown. Tax: unknown.
Install the runtime
1. Create the pinned CPU research environment
Install hashed official CPU wheels and exact native CLIP source. CLIP dependencies/transitive packages resolve at installation; save pip freeze and stop on pip check errors. This is documented compatibility, not an executed environment.
Commandsudo apt-get update sudo apt-get install -y python3.12 python3.12-venv git curl ca-certificates openssl mkdir -p "$HOME/clip-research/models" "$HOME/clip-research/fixture" cd "$HOME/clip-research" python3.12 -m venv .venv .venv/bin/python -m pip install "https://download.pytorch.org/whl/cpu/torch-2.6.0%2Bcpu-cp312-cp312-linux_x86_64.whl#sha256=59e78aa0c690f70734e42670036d6b541930b8eabbaa18d94e090abf14cc4d91" "https://download-r2.pytorch.org/whl/cpu/torchvision-0.21.0%2Bcpu-cp312-cp312-linux_x86_64.whl#sha256=d6874431e678ba107b60a83f255c33f3755f06bad587b1b919aa514ec325dcd8" git clone https://github.com/openai/CLIP.git native-clip git -C native-clip checkout --detach d05afc436d78f1c48dc0dbf8e5980a9d471f35f6 .venv/bin/python -m pip install ./native-clip .venv/bin/python -m pip check .venv/bin/python -m pip freeze > resolved-environment.txtExpected result: Exact checkout and CPU wheel hashes resolve; pip check passes and actual environment is recorded. No GPU driver required.
Download the model
1. Verify checkpoint, native tokenizer vocabulary and fixed fixture
Only the reader following this guide downloads the weight body. The publisher URL contains the expected SHA-256 and archived HEAD reports 353,976,522 bytes; this author did not download it. Verify every selected input before load.
Commandcd "$HOME/clip-research" curl --fail --location --output models/ViT-B-32.pt 'https://openaipublic.azureedge.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af/ViT-B-32.pt' curl --fail --location --output fixture/CLIP.png 'https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/CLIP.png' sha256sum --check <<'SHA256' 40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af models/ViT-B-32.pt 308a3ca4503f1c7a07803916c369d78c4ef501e5ab7fc727da9b5e1d2f9ec85b fixture/CLIP.png 924691ac288e54409236115652ad4aa250f48203de50a9e4722a6ecd48d6804a native-clip/clip/bpe_simple_vocab_16e6.txt.gz SHA256Expected result: All three expected hashes report OK. Stop on mismatch. Only trusted publisher checkpoint is used; no arbitrary PyTorch file input.
Configure
1. Create a private research key
Create a local service key only when absent; preserve existing access and do not print or share it. This is not a provider API key.
Commandcd "$HOME/clip-research" umask 077 if [ ! -e .api-key ]; then openssl rand -hex 32 > .api-key; fi test -s .api-key || { echo "Restore empty key before continuing"; exit 1; } chmod 600 .api-keyExpected result: Private nonempty .api-key exists; existing key preserved.
2. Create the fixed-input research harness
Reader-authored serial HTTPServer binds loopback and accepts only a fixed fixture identifier. It provides no production service guarantees. It loads the exact local image/model and fixed labels; it does not fetch URLs or accept uploads.
Commandcd "$HOME/clip-research" cat > clip_research.py <<'PYSERVER' """OpenTools reader-authored educational demonstrator; not publisher server.""" import hmac,json,os from http.server import BaseHTTPRequestHandler,HTTPServer def handler_factory(generate,key): class Handler(BaseHTTPRequestHandler): protocol_version='HTTP/1.0' def setup(self): super().setup(); self.connection.settimeout(10) def log_message(self,*args): pass def reply(self,status,data): body=json.dumps(data,ensure_ascii=False).encode() self.send_response(status); self.send_header('Content-Type','application/json; charset=utf-8') self.send_header('Content-Length',str(len(body))); self.end_headers(); self.wfile.write(body) def authorized(self): value=self.headers.get('Authorization','').encode() return hmac.compare_digest(value,('Bearer '+key).encode()) def do_GET(self): if not self.authorized(): return self.reply(401,{'error':'unauthorized'}) if self.path!='/health': return self.reply(404,{'error':'not_found'}) self.reply(200,{'status':'ready'}) def do_POST(self): if not self.authorized(): return self.reply(401,{'error':'unauthorized'}) if self.path!='/v1/clip-research': return self.reply(404,{'error':'not_found'}) if self.headers.get('Transfer-Encoding') is not None: return self.reply(400,{'error':'transfer_encoding_unsupported'}) if self.headers.get_content_type()!='application/json': return self.reply(415,{'error':'json_required'}) lengths=self.headers.get_all('Content-Length',[]) if len(lengths)!=1 or not lengths[0] or not all('0'<=c<='9' for c in lengths[0]): return self.reply(411,{'error':'content_length_required'}) if len(lengths[0])>4: return self.reply(413,{'error':'body_limit'}) n=int(lengths[0]) if not 1<=n<=1024: return self.reply(413,{'error':'body_limit'}) try: raw=self.rfile.read(n) if len(raw)!=n: return self.reply(400,{'error':'incomplete_body'}) data=json.loads(raw) except (ValueError,UnicodeError,TimeoutError): return self.reply(400,{'error':'invalid_json'}) if type(data)!=dict or data!={'fixture':'publisher-clip-diagram'}: return self.reply(400,{'error':'fixed_fixture_required'}) try: result=generate() except Exception: return self.reply(500,{'error':'generation_failed'}) self.reply(200,result) return Handler def main(): import torch,clip from PIL import Image from clip.simple_tokenizer import SimpleTokenizer key=open('.api-key',encoding='ascii').read().strip() if len(key)!=64 or any(c not in '0123456789abcdef' for c in key): raise SystemExit('Invalid service key') torch.set_num_threads(4) model,preprocess=clip.load('models/ViT-B-32.pt',device='cpu',jit=False) model.eval() labels=['a diagram','a dog','a cat'] tokenizer=SimpleTokenizer() counts=[len(tokenizer.encode(x))+2 for x in labels] assert all(2<=n<=77 for n in counts) tokens=clip.tokenize(labels,context_length=77,truncate=False) assert list(tokens.shape)==[3,77] with Image.open('fixture/CLIP.png') as im: assert im.size==(2162,762) image=preprocess(im.convert('RGB')).unsqueeze(0) assert list(image.shape)==[1,3,224,224] def generate(): with torch.inference_mode(): i=model.encode_image(image).float() t=model.encode_text(tokens).float() assert list(i.shape)==[1,512] and list(t.shape)==[3,512] i=i/i.norm(dim=-1,keepdim=True) t=t/t.norm(dim=-1,keepdim=True) cosine=i@t.T logits=model.logit_scale.exp()*cosine assert torch.isfinite(cosine).all() and torch.isfinite(logits).all() return {'scope':'private research only; deployed use is outside publisher scope','fixture':'publisher-clip-diagram','labels':labels,'text_tokens_including_bos_eos':counts,'padded_text_shape':[3,77],'image_shape':[1,3,224,224],'image_embedding_shape':[1,512],'text_embedding_shape':[3,512],'cosine':cosine[0].tolist(),'logits':logits[0].tolist(),'highest_label':labels[int(logits[0].argmax())],'calibrated':False} HTTPServer(('127.0.0.1',8996),handler_factory(generate,key)).serve_forever() if __name__=='__main__': main() PYSERVER .venv/bin/python -m py_compile clip_research.pyExpected result: Python syntax check passes without loading the model.
Start the model
1. Start the private fixed-input experiment
In a foreground terminal, load native eager CPU float32 with four threads. Startup verifies input shapes and native text length per fixed label. One request at a time; no public listener, batching service or automatic decisions.
Commandcd "$HOME/clip-research" .venv/bin/python clip_research.pyExpected result: After source-supported but unexecuted load, authenticated health can report ready. Stop on missing input, token overflow or preprocessing assertion.
Connect to your endpoint
http://127.0.0.1:8996/v1/clip-research
Same trusted research desktop loopback only.
Access: loopback. Private Bearer key required for health and research request. Exact JSON body fixture=publisher-clip-diagram only. No image uploads, arbitrary URLs, prompts or new labels. This is a reader-authored experimental harness, not publisher deployment guidance.
Verify the setup
1. Inspect paired-input research output
Run from a second terminal on the server. Confirm exact fixed labels, token counts <=77 including start/end, padded text shape 3x77, image 1x3x224x224, embedding shapes 1x512 and 3x512, and three finite cosine/logit values. The source fixture is an architecture diagram containing dog photographs; inspect this taxonomy limitation yourself. Ranking must be internally consistent with reported logits, but no exact ranking or number is promised. A shape/finite smoke check is not in-domain quality, calibration, bias or deployment validation.
Commandcd "$HOME/clip-research" CLIP_RESEARCH_KEY="$(cat .api-key)" curl --fail http://127.0.0.1:8996/health -H "Authorization: Bearer $CLIP_RESEARCH_KEY" curl --fail http://127.0.0.1:8996/v1/clip-research -H "Authorization: Bearer $CLIP_RESEARCH_KEY" -H 'Content-Type: application/json' -d '{"fixture":"publisher-clip-diagram"}' curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8996/health unset CLIP_RESEARCH_KEYExpected result: Authorized health ready; research JSON contains shapes, per-label counts, finite cosine/logits and highest_label derived from those logits, calibrated=false. Missing key returns 401. No actual model result is claimed.
Performance evidence
No compatible measurement available. Documented support and estimated memory do not establish response speed.
Limits and troubleshooting
- Publisher model card places any deployed use outside scope. This private fixed-input research prototype must not be marketed as production suitable, safe, fair or calibrated; no automatic or consequential decisions.
- ViT-B/32 is an explicitly selected representative inside frozen CLIP family. Nine native variants are listed; eight other variants, other backends and broader paired-input workflows remain unqualified.
- 77 is the native text-encoder token limit per candidate English label including start/end, not pixels, full multimodal context or generated output. Three labels form a text batch3 while one image forms image batch1. Output tokens are not applicable.
- Native BPE/vocabulary and 224 RGB resize/center crop/normalization are pinned. A whole diagram with embedded dog photographs is not a representative in-domain image dataset. Human inspection and broader fixed-taxonomy testing are still needed.
- Native image and text features are normalized and compared; learned-scale logits and any taxonomy ranking are relative to labels, not calibrated truth or proof of general image understanding. No exact score/ranking has been measured.
- The expected native checkpoint digest is publisher-provided and HEAD length captured; no weight body or model execution occurred here. Full fit, speed, latency and memory peak are unknown.
- Native jit=False CPU loading converts to float32. No autoregressive K/V cache, generation sampler, chat template or reasoning mode applies.
- Reader-authored HTTPServer is a serial experimental loopback harness with strict fixed JSON, body bound and socket-read timeout. It has no generation deadline, public TLS or production resilience.
- 32 GiB RAM, 40 GiB disk and four threads are planning allocations. Original dated compute/storage and unknown egress/admin/local power remain separate; no hardware performance is inferred.
- System/transitive package dependencies resolve at installation; save actual versions and logs. Python syntax and fake-encoder transport tests do not establish actual model/dependency compatibility or quality.
- Hash, shape or tokenizer assertion failure
- Stop. Restore exact pinned native source/BPE, publisher checkpoint and fixture; do not bypass native 77-token-per-label error or silently truncate.
- 401 or request rejected
- Use the matching private key and exact fixed fixture JSON. Arbitrary prompts, labels, uploads and remote URLs are intentionally not accepted by this experiment.
- Unexpected ranking
- Inspect the diagram and its embedded photographs, fixed English labels and preprocessing. Record the result without inventing expected scores or treating the highest label as calibrated truth. Any input/taxonomy change needs new experimental validation, not a claim of another completed guide.
- Memory or package load failure
- Stop and inspect available memory and exact CPU dependencies. Record errors; full fit is unmeasured. Do not claim successful model execution from transport-only tests.
Stop the model
1. Stop the experiment
Press Ctrl+C in the server terminal and unset keys in client shells. Confirm loopback port no longer serves.
Commandunset CLIP_RESEARCH_KEYExpected result: Python research harness stops; loopback port 8996 no longer serves.
Uninstall
1. Remove dedicated experiment files
Preserve wanted logs/results first and confirm the dedicated path. Shared system packages may remain.
Commandrm -r -- "$HOME/clip-research"Expected result: Dedicated checkpoint, fixture, native checkout, environment and key removed.
Sources and verification
Sources checked Oct 16, 2026. Verification source
- https://api.github.com/repos/openai/CLIP/commits/mainpublisher · retrieved Oct 16, 2026
- https://huggingface.co/api/models/openai/clip-vit-base-patch32?blobs=truepublisher · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/README.mdpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/LICENSEpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/clip/clip.pypublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/clip/model.pypublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/setup.pypublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://huggingface.co/openai/clip-vit-base-patch32/raw/3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268/README.mdpublisher · retrieved Oct 16, 2026
- https://huggingface.co/openai/clip-vit-base-patch32/raw/3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268/config.jsonpublisher · retrieved Oct 16, 2026
- https://huggingface.co/openai/clip-vit-base-patch32/raw/3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268/tokenizer_config.jsonpublisher · retrieved Oct 16, 2026
- https://huggingface.co/openai/clip-vit-base-patch32/raw/3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268/preprocessor_config.jsonpublisher · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/CLIP.pngpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/clip/simple_tokenizer.pypublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/clip/bpe_simple_vocab_16e6.txt.gzpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/requirements.txtpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://download.pytorch.org/whl/cpu/torchvision/runtime maintainer · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/pytorch/vision/v0.21.0/README.mdruntime maintainer · retrieved Oct 16, 2026
- https://pypi.org/pypi/torchvision/0.21.0/jsonruntime maintainer · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/openai/CLIP/d05afc436d78f1c48dc0dbf8e5980a9d471f35f6/model-card.mdpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://openaipublic.azureedge.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af/ViT-B-32.ptpublisher · retrieved Oct 16, 2026 · revision d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
- https://download.pytorch.org/whl/cpu/torch/runtime maintainer · retrieved Oct 16, 2026
- https://docs.python.org/3.11/library/http.server.htmlruntime maintainer · retrieved Oct 16, 2026
- https://docs.python.org/3.11/library/hmac.htmlruntime maintainer · retrieved Oct 16, 2026
- https://opentools.ai/llms/clipopentools · retrieved Oct 16, 2026 · revision fixed-research-wrapper-v1
- https://www.intel.com/content/www/us/en/products/sku/134586/intel-core-i512400-processor-18m-cache-up-to-4-40-ghz/specifications.htmlmanufacturer · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/ggml/src/ggml-cpu/CMakeLists.txtruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://docs.liquid.ai/lfm/inference/llama-cppruntime maintainer · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/docs/build.mdruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab