Docker-compose run weaviate, module file not download

screenshot-20230719-184933

root@DESKTOP-AOSTR9K:/var/weaviate# pwd
/var/weaviate
root@DESKTOP-AOSTR9K:/var/weaviate# ll
total 144
drwxrwxrwx  4 root root   4096 Jul 19 18:40 ./
drwxr-xr-x 14 root root   4096 Jul 19 17:31 ../
-rw-------  1 root root  32768 Jul 19 18:01 classifications.db
-rw-r--r--  1 root root      0 Jul 19 17:31 migration1.19.filter2search.skip.flag
-rw-r--r--  1 root root      0 Jul 19 17:31 migration1.19.filter2search.state
-rw-------  1 root root  16384 Jul 19 17:31 modules.db
drwxr-xr-x  2 root root   4096 Jul 19 18:40 question_NZSApGHeIhG3.hnsw.commitlog.d/
-rw-r--r--  1 root root      0 Jul 19 18:40 question_NZSApGHeIhG3.indexcount
-rw-r--r--  1 root root     47 Jul 19 18:40 question_NZSApGHeIhG3.proplengths
-rw-r--r--  1 root root     47 Jul 19 18:40 question_NZSApGHeIhG3.proplengths.bak
-rw-r--r--  1 root root      2 Jul 19 18:40 question_NZSApGHeIhG3.version
drwx------ 10 root root   4096 Jul 19 18:40 question_NZSApGHeIhG3_lsm/
-rw-------  1 root root 131072 Jul 19 18:40 schema.db
root@DESKTOP-AOSTR9K:/var/weaviate#

code:

client, err := weaviate.NewClient(cfg)
if err != nil {
	fmt.Printf(err.Error())
	panic(err)
}

// delete the class
if err := client.Schema().ClassDeleter().WithClassName("Question").Do(context.Background()); err != nil {
	// Weaviate will return a 400 if the class does not exist, so this is allowed, only return an error if it's not a 400
	if status, ok := err.(*fault.WeaviateClientError); ok && status.StatusCode != http.StatusBadRequest {
		panic(err)
	}
}

classObj := &models.Class{
	Class:      "Question",
	Vectorizer: "text2vec-huggingface",
	ModuleConfig: map[string]interface{}{
		"text2vec-huggingface": map[string]interface{}{
			"model":       "moka-ai/m3e-base",
			// "endpointURL": "https://api-inference.huggingface.co/models/moka-ai/m3e-base",
			"options": map[string]interface{}{
				"waitForModel": true,
			},
		},
	},
}

if client.Schema().ClassCreator().WithClass(classObj).Do(context.Background()) != nil {
	panic(err)
}

schema, err := client.Schema().Getter().Do(context.Background())
if err != nil {
	fmt.Printf(err.Error())
	panic(err)
}
fmt.Printf("%+v", schema)

dataStr := "[{\"Category\":\"SCIENCE\",\"Question\":\"This organ removes excess glucose from the blood & stores it as glycogen\",\"Answer\":\"Liver\"},{\"Category\":\"ANIMALS\",\"Question\":\"It's the only living mammal in the order Proboseidea\",\"Answer\":\"Elephant\"},{\"Category\":\"ANIMALS\",\"Question\":\"The gavial looks very much like a crocodile except for this bodily feature\",\"Answer\":\"the nose or snout\"},{\"Category\":\"ANIMALS\",\"Question\":\"Weighing around a ton, the eland is the largest species of this animal in Africa\",\"Answer\":\"Antelope\"},{\"Category\":\"ANIMALS\",\"Question\":\"Heaviest of all poisonous snakes is this North American rattlesnake\",\"Answer\":\"the diamondback rattler\"},{\"Category\":\"SCIENCE\",\"Question\":\"2000 news: the Gunnison sage grouse isn't just another northern sage grouse, but a new one of this classification\",\"Answer\":\"species\"},{\"Category\":\"SCIENCE\",\"Question\":\"A metal that is ductile can be pulled into this while cold & under pressure\",\"Answer\":\"wire\"},{\"Category\":\"SCIENCE\",\"Question\":\"In 1953 Watson & Crick built a model of the molecular structure of this, the gene-carrying substance\",\"Answer\":\"DNA\"},{\"Category\":\"SCIENCE\",\"Question\":\"Changes in the tropospheric layer of this are what gives us weather\",\"Answer\":\"the atmosphere\"},{\"Category\":\"SCIENCE\",\"Question\":\"In 70-degree air, a plane traveling at about 1,130 feet per second breaks it\",\"Answer\":\"Sound barrier\"}]"

// Decode the data
var items []map[string]string
if err := json.Unmarshal([]byte(dataStr), &items); err != nil {
	fmt.Printf(err.Error())
	panic(err)
}
// convert items into a slice of models.Object
objects := make([]*models.Object, len(items))
for i := range items {
	objects[i] = &models.Object{
		Class: "Question",
		Properties: map[string]any{
			"category": items[i]["Category"],
			"question": items[i]["Question"],
			"answer":   items[i]["Answer"],
		},
	}
}

// batch write items
batchRes, err := client.Batch().ObjectsBatcher().WithObjects(objects...).Do(context.Background())
if err != nil {
	fmt.Printf(err.Error())
	panic(err)
}
for _, res := range batchRes {
	if res.Result.Errors != nil {
		fmt.Printf(res.Result.Errors.Error[0].Message)
		panic(res.Result.Errors.Error)
	}
}`

error:

update vector: failed with status: 400 error: Task not found for this model

docker-log:

2023-07-19 19:02:44 {"action":"startup","default_vectorizer_module":"text2vec-huggingface","level":"info","msg":"the default vectorizer modules is set to \"text2vec-huggingface\", as a result all new schema classes without an explicit vectorizer setting, will use this vectorizer","time":"2023-07-19T11:02:44Z"}
2023-07-19 19:02:44 {"action":"startup","auto_schema_enabled":true,"level":"info","msg":"auto schema enabled setting is set to \"true\"","time":"2023-07-19T11:02:44Z"}
2023-07-19 19:02:44 {"action":"hnsw_vector_cache_prefill","count":3000,"index_id":"question_NZSApGHeIhG3","level":"info","limit":1000000000000,"msg":"prefilled vector cache","time":"2023-07-19T11:02:44Z","took":52675}
2023-07-19 19:02:44 {"level":"warning","msg":"Multiple vector spaces are present, GraphQL Explore and REST API list objects endpoint module include params has been disabled as a result.","time":"2023-07-19T11:02:44Z"}
2023-07-19 19:02:44 {"action":"grpc_startup","level":"info","msg":"grpc server listening at [::]:50051","time":"2023-07-19T11:02:44Z"}
2023-07-19 19:02:44 {"action":"restapi_management","level":"info","msg":"Serving weaviate at http://[::]:8080","time":"2023-07-19T11:02:44Z"}

Hi there @user2, I’m not super familiar with this error but - is it possible that this model isn’t configured to be compatible with the Weaviate module?

Do you still get this error with other models that we know works with Weaviate?

Okay, I will try the documentation provided text2vec-huggingface using the all-MiniLM-L6-v2 model.

refer:text2vec-huggingface | Weaviate - vector database

still get this error:
update vector: failed with status: 400 error: Task not found for this model

Hi @user2

That error is from the Hugging Face side (not Weaviate), indicating that the model used doesn’t have the task (embedding/feature extraction) available. Which is odd, if the model is one that should allow this task.

Could you post your code as used? That might help us to debug.

Also, just noticed that you have a TRANFORMERS_MODEL environment variable. I don’t think that’ll have an effect. I don’t see in our docs either.

Did you find that reference somewhere?

Also, I will change the post category to “support”.