`AttributeError: 'str' object has no attribute 'to'` in CachedGISTEmbedLoss
Author: marianrh-apaCreated Sep 23, 2026Updated Sep 25, 2026
Hi,
since upgrading Sentence Transformers I'm getting the error AttributeError: 'str' object has no attribute 'to' when starting an embedding model training using CachedGISTEmbedLoss. The version I upgraded from (where everything still worked) was v5.3.0.
I found out that a fix was applied to the (non-cached) GISTEmbedLoss in 9bac152840515e1d4d37d36ce82d5ce9945c7ba7 as part of the work done in #3554. It looks to me like the CachedGISTEmbedLoss was simply missed, so I propose to add the fix from 9bac152840515e1d4d37d36ce82d5ce9945c7ba7 here as well.
Thanks for considering!
Source: huggingface/sentence-transformers