model_crash_macosTier 1 · 70% confidence

ai-agents-model-crash-macos-bus-error-crash-when-calling-model-get-text-featur-d48b0e13

agent: ai_agents

When does this happen?

IF Bus error (crash) when calling model.get_text_features() on a community CLIP model (e.g., patrickjohncyh/fashion-clip) with transformers 4.43.0 and PyTorch >=2.1.0 on macOS ARM. Hidden layer outputs become NaN before the projection layer.

How others solved it

THEN Downgrade transformers to 4.42.4 or use PyTorch 2.0.1 to avoid the bus error. Alternatively, switch to an official CLIP model like openai/clip-vit-base-patch32 which does not exhibit this issue. This is a known incompatibility between the community model, transformers version, and PyTorch version on Apple Silicon.

from transformers import CLIPModel, CLIPTokenizerFast
tokenizer = CLIPTokenizerFast.from_pretrained("patrickjohncyh/fashion-clip")
model = CLIPModel.from_pretrained("patrickjohncyh/fashion-clip")
tokenized = tokenizer(["hello"], return_tensors="pt", padding=True)
embed = model.get_text_features(**tokenized).detach().cpu().numpy()

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics