h2oai / h2ogpt

Private chat with local GPT with document, images, video, etc. 100% private, Apache 2.0. Supports oLLaMa, Mixtral, llama.cpp, and more. Demo: https://gpt.h2o.ai/ https://gpt-docs.h2o.ai/
http://h2o.ai
Apache License 2.0
11.28k stars 1.24k forks source link

embedding model Cohere/Cohere-embed-multilingual-v3.0 not supported. #1779

Closed juerware closed 1 month ago

juerware commented 2 months ago

Command line executed:

export max_input_tokens=8192;
export max_total_input_tokens=16384;
export chunk_size=2048;
TOKENIZERS_PARALLELISM=true python generate.py \
    --base_model=meta-llama/Meta-Llama-3.1-8B-Instruct --prompt_type=llama2 \
    --use_gpu_id=True --gpu_id=-1 --max_seq_len=8192 \
    --user_path=/opt/myDocuments/all/ --langchain_mode='UserData' --max_quality=True \
    --add_chat_history_to_context=True --keep_sources_in_context=True --enable_ocr=True --enable_doctr=True \
    --answer_with_sources=True --show_link_in_sources=True --append_sources_to_chat=True \
    --hf_embedding_model="Cohere/Cohere-embed-multilingual-v3.0" \
    --memory_restriction_level=0 --score_model=None --verbose=True --debug=True \
    --show_examples=True --compile_model=True \
    --share=True \
    --max_input_tokens=$max_input_tokens --max_total_input_tokens=$max_total_input_tokens --chunk_size=$chunk_size;

Error output:

WARNING:sentence_transformers.SentenceTransformer:No sentence-transformers model found with name Cohere/Cohere-embed-multilingual-v3.0. Creating a new one with mean pooling.
Traceback (most recent call last):
  File "/root/REPOSITORIES/aramirez/void_h2ogtp/generate.py", line 20, in <module>
    entrypoint_main()
  File "/root/REPOSITORIES/aramirez/void_h2ogtp/generate.py", line 16, in entrypoint_main
    H2O_Fire(main)
  File "/root/REPOSITORIES/aramirez/void_h2ogtp/src/utils.py", line 75, in H2O_Fire
    fire.Fire(component=component, command=args)
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/root/REPOSITORIES/aramirez/void_h2ogtp/src/gen.py", line 2015, in main
    model=get_embedding(use_openai_embedding, hf_embedding_model=hf_embedding_model,
  File "/root/REPOSITORIES/aramirez/void_h2ogtp/src/gpt_langchain.py", line 559, in get_embedding
    embedding = HuggingFaceEmbeddings(model_name=hf_embedding_model, model_kwargs=model_kwargs)
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/langchain_core/_api/deprecation.py", line 203, in warn_if_direct_instance
    return wrapped(self, *args, **kwargs)
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/langchain_community/embeddings/huggingface.py", line 79, in __init__
    self.client = sentence_transformers.SentenceTransformer(
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 299, in __init__
    modules = self._load_auto_model(
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 1324, in _load_auto_model
    transformer_model = Transformer(
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/sentence_transformers/models/Transformer.py", line 53, in __init__
    config = AutoConfig.from_pretrained(model_name_or_path, **config_args, cache_dir=cache_dir)
  File "/root/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1004, in from_pretrained
    raise ValueError(
ValueError: Unrecognized model in Cohere/Cohere-embed-multilingual-v3.0. Should have a `model_type` key in its config.json, ....

As it can be seen there is no support for embedding model Cohere/Cohere-embed-multilingual-v3.0 from huggingface.

Some idea would be appreciated, thanks in advance.


SO: Ubuntu 22.04.4 LTS Commit: 10571004 (last at the moment this script was executed)

pseudotensor commented 1 month ago

That's true, it's not a local model. The https://huggingface.co/Cohere/Cohere-embed-multilingual-v3.0 only contains the tokenizer. This is a paid model for Cohere via their API, I wouldn't easily support and probably little value in it.