# WCS DEPLOYMENT of text2vec-transformer

**URL:** <https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418>\
**Category:** Support\
**Created:** [February 7, 2024, 4:27pm UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418 "2024-02-07T16:27:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky\_D](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/ricky_d/32/928_2.png) [@Ricky\_D](https://forum.weaviate.io/u/Ricky_D)\
**Post date:** [February 7, 2024, 4:27pm UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418/1 "2024-02-07T16:27:59Z")

</div>

Hi,  
I am very new to weaviate, I have created a schema in my docker and imported the data from a CSV. I did the vectorizing using SBERT paraphrase-multilingual-mpnet-base-v2 model as it is multilingual application I am Building.

When I wanted to deploy this in WCS, I found that text2vec-transformer is not available as a module. So I used text2vec-huggingface sentence-transformers/paraphrase-multilingual-mpnet-base-v2 model. But unfortunately I cannot import the data.

Is there any other way or any other model that I should use?

Please help.

Thanks 🙏

---

<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:** [February 7, 2024, 6:39pm UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418/2 "2024-02-07T18:39:15Z")

</div>

hi @Ricky_D !

Welcome to our Community 🤗

As you mentioned, we do not provide all available modules in WCS.

So using [text2vec-huggingface](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-huggingface) is a way to use that same model.

Why you were not able to import data? Was there any errors or logs?

Thanks!

---

<div class="post-metadata">

**Author:** ![Ricky\_D](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/ricky_d/32/928_2.png) [@Ricky\_D](https://forum.weaviate.io/u/Ricky_D)\
**Post date:** [February 8, 2024, 9:09am UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418/3 "2024-02-08T09:09:20Z")

</div>

Hi @DudaNogueira  
I have tried this code:

> import weaviate  
> from weaviate import Config  
> import weaviate.classes as wvc  
> import weaviate.exceptions  
> import os  
> import pandas as pd  
> import numpy as np  
> import json  
> import datetime  
> from datetime import datetime
> 
> # Starting up the weaviate client
> 
> auth\_config = weaviate.auth.AuthApiKey(api\_key=“API”)  
> client = weaviate.Client(  
> url=“[https://someweaviate.network](https://someweaviate.network)”,  
> auth\_client\_secret=auth\_config,  
> additional\_headers={  
> “X-HuggingFace-Api-Key”: “API\_hf”  
> }  
> )  
> client.is\_ready()
> 
> # Deleting any previously existing “MachineFailures” class
> 
> print(“delete previous”)  
> client.schema.delete\_class(“MachineFailures”)
> 
> # Creating a new class with the defined schema
> 
> #Here “vectorizer”: “text2vec-transformers” it is using: the default transformer model used was `bert-base-uncased`.  
> #If you need to use a specific transformer model, such as `paraphrase-multilingual-mpnet-base-v2`,  
> #and Weaviate’s default model does not meet your requirements, you may need to vectorize your text data outside of Weaviate using the Sentence Transformers library,  
> #as I described in the previous answer, and then store the resulting vectors in Weaviate manually.
> 
> # Created all the properties with ‘text’ so it enables with semantic and keyword search(Hybrid search)
> 
> client.schema.create\_class(  
> {  
> “class”: “MachineFailures”,  
> “description”: “A class to store machine failure records”,  
> “vectorIndexConfig”: {  
> “distance” : “cosine”  
> },  
> “vectorIndexType”: “hnsw”,  
> “vectorizer”: “text2vec-huggingface”,  
> “moduleConfig”: {  
> “text2vec-huggingface”: {  
> “model”: “sentence-transformers/paraphrase-multilingual-mpnet-base-v2”,  
> }  
> },  
> “properties”: [  
> {  
> “name”: “description”,  
> “dataType”: [“text”],  
> },  
> {  
> “name”: “wo\_number”,  
> “dataType”: [“number”],  
> },  
> {  
> “name”: “heading”,  
> “dataType”: [“text”],  
> },  
> {  
> “name”: “fail\_source”,  
> “dataType”: [“text”],  
> },  
> {  
> “name”: “fail\_cause”,  
> “dataType”: [“text”],  
> },  
> {  
> “name”: “wo\_closed\_on”,  
> “dataType”: [“date”],  
> },  
> {  
> “name”: “repairman”,  
> “dataType”: [“text”],  
> },  
> {  
> “name”: “working\_hours”,  
> “dataType”: [“number”],  
> },  
> {  
> “name”: “machine\_no”,  
> “dataType”: [“text”],  
> },  
> {  
> “name”: “workdone\_comments”,  
> “dataType”: [“text”],  
> },
> 
> ```
> ],
> 
> }
> 
> ```
> 
> )
> 
> # Checking is the collection is created successfully or not
> 
> print(“create new”)  
> print(client.collection.exists(“MaichineFailures”))
> 
> # Importing the data using pandas
> 
> data = pd.read\_csv(‘./data/MachineFailures.csv’, index\_col=0)
> 
> # Getting the collection “DiseaseSearch” that was created earlier
> 
> Machine\_Failures\_data = client.collection.get(“MachineFailures”)
> 
> # Function to format dates in Weaviate ISO8601 format
> 
> def format\_date\_weaviate(date):  
> # Convert the date to a pandas datetime object  
> date\_obj = pd.to\_datetime(date, errors=‘coerce’) # ‘coerce’ will convert invalid dates to NaT  
> # Check if the date is NaT (Not-a-Time)  
> if pd.isna(date\_obj):  
> return None # or return a default date string in the correct format, if applicable  
> # Format the date to Weaviate’s expected ISO8601 format  
> return date\_obj.strftime(“%Y-%m-%dT%H:%M:%S+00:00”)
> 
> # Iterating through the dataset and storing it all in an array to be inserted later
> 
> objects\_to\_add = [  
> {  
> “description”: row[“description”],  
> “wo\_number”: row[“wo\_number”],  
> “heading”: row[“heading”],  
> “fail\_source”: row[“fail\_source”],  
> “fail\_cause”: row[“fail\_cause”],  
> “wo\_closed\_on”:format\_date\_weaviate(row[“wo\_closed\_on”]),  
> “repairman”: row[“repairman”],  
> “working\_hours”: row[“working\_hours”], # Convert to string  
> “machine\_no”: row[“machine\_no”], # Convert to string if needed  
> “workdone\_comments”: row[“workdone\_comments”],  
> }  
> for index, row in data.iterrows()  
> ]
> 
> # Define a function to replace non-compliant float values
> 
> def replace\_non\_compliant\_values(value):  
> if isinstance(value, float) and (np.isnan(value) or np.isinf(value)):  
> return None # Replace with None or an appropriate placeholder  
> return value
> 
> # Inserting the data into the class
> 
> for obj in objects\_to\_add:  
> # Replace non-compliant float values in the object  
> sanitized\_obj = {k: replace\_non\_compliant\_values(v) for k, v in obj.items()}  
> client.data\_object.create(sanitized\_obj, “MachineFailures”)
> 
> # Fetching any 5 objects from the class and printing the response
> 
> query\_string = “”"  
> {  
> Get {  
> MachineFailures(limit: 5) {  
> description  
> wo\_number  
> machine\_no  
> heading  
> repairman  
> }  
> }  
> }  
> “”"  
> response = client.query.raw(query\_string)  
> print(“Output”)  
> print(response)

But i received this error:  
`weaviate.exceptions.UnexpectedStatusCodeException: Creating object! Unexpected status code: 500, with response body: {'error': [{'message': 'update vector: failed with status: 503 error: Model sentence-transformers/paraphrase-multilingual-mpnet-base-v2 is currently loading estimated time: 44.490128'}]}.`

But in my docker using text2vec-transformers module i had success to import that data.  
WHat can be the problem. Thanks in advance.  
//Ricky

---

<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:** [February 8, 2024, 1:32pm UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418/4 "2024-02-08T13:32:58Z")

</div>

Hi!

This is most likely an issue with the inference model, returning you 500 http code. My bet is that the inference model is not yet ready to vectorization, or failed to start.

Can you try vectorizing something directly in that vectorizer to make sure it is working properly?

---

<div class="post-metadata">

**Author:** ![Ricky\_D](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/ricky_d/32/928_2.png) [@Ricky\_D](https://forum.weaviate.io/u/Ricky_D)\
**Post date:** [February 8, 2024, 2:05pm UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418/5 "2024-02-08T14:05:38Z")

</div>

Hi,  
My local docker image is:

> version: ‘3.4’  
> image: semitechnologies/weaviate:1.23.2  
> DEFAULT\_VECTORIZER\_MODULE: ‘text2vec-transformers’  
> ENABLE\_MODULES: ‘text2vec-transformers’  
> CLUSTER\_HOSTNAME: ‘node1’
> 
> t2v-transformers:  
> image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-multilingual-mpnet-base-v2

and the code of import is: which vectorizing with transformers-inference:sentence-transformers-paraphrase-multilingual-mpnet-base-v2 model.

> client.schema.create\_class(  
> {  
> “class”: “MachineFailures”,  
> “description”: “A class to store machine failure records”,  
> “vectorIndexConfig”: {  
> “distance” : “cosine”  
> },  
> “vectorIndexType”: “hnsw”,  
> “vectorizer”: “text2vec-transformers”,  
> “properties”: [

I don’t know if you exactly meant that.  
Thanks

---

<div class="post-metadata">

**Author:** ![Ricky\_D](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/ricky_d/32/928_2.png) [@Ricky\_D](https://forum.weaviate.io/u/Ricky_D)\
**Post date:** [February 8, 2024, 3:14pm UTC](https://forum.weaviate.io/t/wcs-deployment-of-text2vec-transformer/1418/6 "2024-02-08T15:14:18Z")

</div>

Hi  
With Cohere, I managed to import and run my app.  
Thanks for the help.
