# Text2vec\_huggingface is not working

**URL:** <https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931>\
**Category:** Support\
**Created:** [May 6, 2025, 1:05pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931 "2025-05-06T13:05:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![4oned](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/4oned/32/7220_2.png) [@4oned](https://forum.weaviate.io/u/4oned)\
**Post date:** [May 6, 2025, 1:05pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931/1 "2025-05-06T13:05:28Z")

</div>

### Description

im trying to connect weaviate to my hugging face endpoint using hf api key :

```python
def create_weaviate_client(huggingface_key, weaviate_url, weaviate_api_key):
    headers = {"X-HuggingFace-Api-Key": huggingface_key}
    client = weaviate.connect_to_weaviate_cloud(
        cluster_url=weaviate_url,
        auth_credentials=Auth.api_key(weaviate_api_key),
        headers=headers
    )
    return client

# Import schema to Weaviate
def import_schema_to_weaviate(client, schema_data, model):
    schema_name = schema_data["database_name"]+"hi1"

    # Create the schema collection in Weaviate
    client.collections.create(
        name=schema_name,
        vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_huggingface(model=model),
        vector_index_config=Configure.VectorIndex.hnsw(), # Use the HNSW index
        properties=[
            wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT),
            wvc.config.Property(name="type", data_type=wvc.config.DataType.TEXT),
            wvc.config.Property(name="entity", data_type=wvc.config.DataType.TEXT),
            wvc.config.Property(name="description", data_type=wvc.config.DataType.TEXT)
        ]
    )
    print(f"Schema {schema_name} created successfully.")

```

the collelction is created successfully  
but when i insert new object : for entry in schema\_entries:  
schema\_collection.data.insert(properties=entry) , i get the following error : Error data insertion: Object was not added! Unexpected status code: 500, with response body: {‘error’: [{‘message’: ‘vectorize target vector : update vector: unmarshal error response body: Not Found’}]}.  
Error data insertion: Object was not added! Unexpected status code: 500, with response body: {‘error’: [{‘message’: ‘vectorize target vector : update vector: unmarshal error response body: Not Found’}]}.

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [May 6, 2025, 1:09pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931/2 "2025-05-06T13:09:06Z")

</div>

hi @4oned !!

Welcome to our community 🤗 !!

This error message seems to be an issue from the vectorizer.

What is the value of the variable model?

Here you can find more information on Huggingface available models:

> **[Text Embeddings | Weaviate](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings#available-models)**
>
> Weaviate's integration with Hugging Face's APIs allows you to access their models' capabilities directly from Weaviate.

Let me know if this helps!

Thanks!

---

<div class="post-metadata">

**Author:** ![4oned](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/4oned/32/7220_2.png) [@4oned](https://forum.weaviate.io/u/4oned)\
**Post date:** [May 6, 2025, 1:12pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931/3 "2025-05-06T13:12:13Z")

</div>

Thank you so much , @DudaNogueira  
The model i’m using is : BAAI/bge-base-en-v1.5 , and it worked for me before with the same code ; i guess it’s from hugging face part

---

<div class="post-metadata">

**Author:** ![manuharari](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/manuharari/32/4097_2.png) [@manuharari](https://forum.weaviate.io/u/manuharari)\
**Post date:** [May 14, 2025, 11:28pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931/4 "2025-05-14T23:28:03Z")

</div>

Hello! I’ve been having this problem recently (past two weeks). Did you find any helpful solution? I’m doing it on java with hugging face inference.

---

<div class="post-metadata">

**Author:** ![manuharari](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/manuharari/32/4097_2.png) [@manuharari](https://forum.weaviate.io/u/manuharari)\
**Post date:** [May 14, 2025, 11:31pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931/5 "2025-05-14T23:31:50Z")

</div>

> [@4oned](#):
>
> BAAI/bge-base-en-v1.5

I’ve used sentence-transformers/all-mpnet-base-v2 and haven’t found any luck. Any Suggestions Duda?

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [May 15, 2025, 7:00pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-is-not-working/20931/6 "2025-05-15T19:00:47Z")

</div>

This seems to be cause by hugging face api changes:

> [@Weaviate "update vector: unmarshal error response body: Not Found" on Object Creation with text2vec-huggingface](https://forum.weaviate.io/t/weaviate-update-vector-unmarshal-error-response-body-not-found-on-object-creation-with-text2vec-huggingface/21059/2):
>
> Hi @manuharari !! I believe this issue is related to this PR: Note that this PR was backported only to 1.28.15: I noticed you are using a really old version, 1.26.0 So I suggest you to upgrade path: 1.26.0 → 1.26.latest → restart → 1.27.latest → restart → 1.28.latest in between each restart, wait all the data get loaded and the cluster stabilized. Or, of your data is not too big, you can copy your data over to a new cluster running the latest version or the target version. Let me know …
