llama-gpt icon indicating copy to clipboard operation
llama-gpt copied to clipboard

model_config['protected_namespaces'] = ('settings_',)`

Open lityrdef opened this issue 1 year ago • 5 comments

(base) ┌─(~/Downloads/llama-gpt-master)────────────────(iwis@iwisdeMacBook-Air:s000)─┐ └─(02:52:27)──> /Users/iwis/miniforge3/envs/llama-gpt/lib/python3.10/site-packages/pydantic/_internal/fields.py:127: UserWarning: Field "model_alias" has conflict with protected namespace "model".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = ('settings_',). warnings.warn(

Same issue on mac or win.

lityrdef avatar Aug 22 '23 18:08 lityrdef

I have little know for python

Here the GPT:

The warning message you're seeing is coming from the Python library pydantic, which is used for data parsing and validation. It's telling you that the field model_alias in your data model is conflicting with a protected namespace model.

The message also gives a suggestion on how to possibly resolve this warning by setting model_config['protected_namespaces'] = ('settings_',). This would mean adding 'settings_' to the protected namespaces of your model_config.

However, this suggestion may not solve the problem if the actual conflict is with the model_alias field. You should consider renaming the model_alias field in your data model to avoid this conflict.

Your code might look something like this:

from pydantic import BaseModel

class MyModel(BaseModel):
    model_alias: str = 'default_value'  # This is conflicting with protected namespace "model"

# Change it to:
class MyModel(BaseModel):
    my_model_alias: str = 'default_value'  # No conflict now

But, it's hard to provide a more specific solution without seeing your actual code. If you need more help, please provide more context or more specific code.

lityrdef avatar Aug 22 '23 18:08 lityrdef

I have the same problem. Were you able to get this resolved?

rickykresslein avatar Aug 28 '23 17:08 rickykresslein

I have this same problem but only when trying to run the code models. the chat works fine.

M0E-lnx avatar Sep 15 '23 13:09 M0E-lnx

Saw similar here with possible solution: https://github.com/getumbrel/llama-gpt/issues/98#issuecomment-1715494487

s3rvant avatar Sep 15 '23 13:09 s3rvant

Saw similar here with possible solution: #98 (comment)

This fixes things for me, thanks for the steer!

biodrone avatar Sep 23 '23 17:09 biodrone