run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.78k stars 5.27k forks source link

[Question]: trust_remote_code=True #10373

Closed Bearsaerker closed 3 months ago

Bearsaerker commented 9 months ago

Question Validation

Question

I'm trying to get the onnx of jina running. It tells me, that I have to pass the argument "trust_remote_code=True", but I can't as it is described in the example of the Llama Index Embeddings Guide Doc.

from llama_index.embeddings import OptimumEmbedding

OptimumEmbedding.create_and_save_optimum_model(
     "jinaai/jina-embeddings-v2-base-de", "./JinaONNX"
)

It may be that I'm too stupid to find the right place to insert it, but help would be very appreciated!

dosubot[bot] commented 9 months ago

🤖

Hey @Bearsaerker! Great to see you back with another intriguing question. Hope you've been doing well!

Based on the context provided, it seems like you're trying to initialize the OptimumEmbedding model with the trust_remote_code=True argument. However, in the example you've provided, the OptimumEmbedding model is being initialized without any arguments.

The trust_remote_code=True argument is typically used when initializing the HuggingFaceEmbedding model, as shown in the code snippet from the jina_embeddings.ipynb example:

# download model locally
# note: you need enough RAM+compute to run this
embed_model = HuggingFaceEmbedding(
    model_name=model_name, trust_remote_code=True
)

In this code, the HuggingFaceEmbedding model is being initialized with the model_name variable and the trust_remote_code argument is set to True. This means that the model will trust and execute remote code when necessary.

If you're trying to use the trust_remote_code=True argument with the OptimumEmbedding model, it's possible that this argument is not supported. I recommend checking the documentation or the source code of the OptimumEmbedding model to see if this argument is supported.

If you're still having trouble, could you please provide more information about the error message you're receiving and the exact code you're trying to run? This will help me better understand the issue and provide a more accurate solution.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

shaoyu-lu commented 6 months ago
OptimumEmbedding.create_and_save_optimum_model(
     "jinaai/jina-embeddings-v2-base-de", 
     "./JinaONNX", 
     export_kwargs={'trust_remote_code': True}
     )

Give this a try. I successfully passed trust_remote_code by using export_kwargs.

dosubot[bot] commented 6 months ago

@logan-markewich Could you please assist @shaoyu-lu with the issue of passing parameters using export_kwargs when initializing the OptimumEmbedding model? They have provided an example where they successfully passed the parameters. Thank you!

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.