Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: BertModel.__init__() got an unexpected keyword argument 'safe_serialization' #1195

Closed
philiprhoades opened this issue Mar 28, 2024 · 9 comments · Fixed by #1222
Closed
Assignees
Labels
bug Something isn't working

Comments

@philiprhoades
Copy link

Describe the bug:
Error for memgpt talking to local LLM.

Please describe your setup:
What is the output of memgpt version? (eg "0.2.4")
0.3.7

How did you install memgpt?
pip install pymemgpt
and:
pip install 'pymemgpt[local]'

Describe your setup:
What's your OS:
Fedora Linux v38 (for Python3.11)

How are you running memgpt?
tmux Terminal

I have successfully installed oobabooga in Fedora Linux, downloaded and loaded "ehartford_dolphin-2.2.1-mistral-7b" and can chat happily from the oobabooga console but when I try and connect with memgpt using either the airoboros-l2-70b-2.1 or the dolphin-2.1-mistral-7b wrapper I get an error:

# memgpt run                                                                                                                                                     
                                                                                                                                                                              
__ Creating new agent...                                                                                                                                                      
->  __ Using persona profile: 'sam_pov'                                                                                                                                       
->  __ Using human profile: 'basic'                                                                                                                                           
Traceback (most recent call last):                                                                                                                                            
  File "/usr/local/bin/memgpt", line 8, in <module>                                                                                                                           
    sys.exit(app())                                                                                                                                                           
             ^^^^^                                                                                                                                                            
  File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 328, in __call__                                                                                         
    raise e                                                                                                                                                                   
  File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 311, in __call__                                                                                         
    return get_command(self)(*args, **kwargs)                                                                                                                                 
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                 
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__                                                                                        
    return self.main(*args, **kwargs)                                                                                                                                         
           ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                         
  File "/usr/local/lib/python3.11/site-packages/typer/core.py", line 783, in main                                                                                             
    return _main(                                                                                                                                                             
           ^^^^^^                                                                                                                                                             
  File "/usr/local/lib/python3.11/site-packages/typer/core.py", line 225, in _main                                                                                            
    rv = self.invoke(ctx)                                                                                                                                                     
         ^^^^^^^^^^^^^^^^                                                                                                                                                     
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke                                                                                          
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                   
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                    
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke                                                                                          
    return ctx.invoke(self.callback, **ctx.params)                                                                                                                            
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                            
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke                                                                                           
    return __callback(*args, **kwargs)                                                                                                                                        
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                        
  File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 683, in wrapper                                                                                          
    return callback(**use_params)  # type: ignore                                                                                                                             
           ^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                             
  File "/usr/local/lib/python3.11/site-packages/memgpt/cli/cli.py", line 683, in run
    memgpt_agent = Agent(
                   ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/memgpt/agent.py", line 264, in __init__ 
    self.persistence_manager = LocalStateManager(agent_state=self.agent_state)
File "/usr/local/lib/python3.11/site-packages/memgpt/memory.py", line 369, in __init__
    self.embed_model = embedding_model(agent_state.embedding_config)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/memgpt/embeddings.py", line 201, in embedding_model
    return default_embedding_model()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/memgpt/embeddings.py", line 141, in default_embedding_model
    return HuggingFaceEmbedding(model_name=model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/llama_index/embeddings/huggingface/base.py", line 83, in __init__
    model = AutoModel.from_pretrained(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 563, in from_pretrained
    return model_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transformers/modeling_utils.py", line 3404, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BertModel.__init__() got an unexpected keyword argument 'safe_serialization'
@matthieupoirot1
Copy link

I've got the same problem trying to contact ollama on windows.
I tried with memgpt version 0.3.7, 0.3.6 and 0.3.5 each time reinstalling 'pymemgpt[local]' through pip install

@KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
Copy link

KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK commented Mar 29, 2024

I have the same problem on Google Colab (llama.cpp).

I also tried memgpt 0.3.7 -> 0.3.6 and got the same error with both versions.

I suspected that Google Colab's default python and pip environment was having an effect, so I tried Python in the order of 3.10 -> 3.11, but the same error occurred with every version.

The error seems to be related to the transformer, so the situation may change if you clone memgpt from git, change the transformer version, and then install it.

(Sorry, I don't have time to try this right now)

I look forward to this issue being resolved soon.

@philiprhoades
Copy link
Author

The error seems to be related to the transformer, so the situation may change if you clone memgpt from git, change the transformer version, and then install it.

I don't quite understand why you think building from git will make a difference - can you expand on that idea?

@farbel
Copy link

farbel commented Mar 29, 2024

If you make use of llama_index, this may help: run-llama/llama_index#11939 (comment) (bug in llama-index-embeddings-huggingface 0.1.5, solved in 0.2.0)

@YanSte
Copy link

YanSte commented Apr 1, 2024

Solved my issue:
Thanks @farbel

llama-index-embeddings-huggingface 0.1.5, solved in 0.2.0

@philiprhoades
Copy link
Author

Not mine:

pip install llama-index-embeddings-huggingface upgrade
Requirement already satisfied: llama-index-embeddings-huggingface in /usr/local/lib/python3.11/site-packages (0.1.5)
ERROR: Could not find a version that satisfies the requirement upgrade (from versions: none)
ERROR: No matching distribution found for upgrade

I am using an old Fedora (38) so I can use Python3.11 - which I needed to do to fix an earlier problem . .

@philiprhoades
Copy link
Author

@YanSte ,

Did you read my response? - I tried to update llama-index-embeddings-huggingface to 0.2.0 but CAN'T . .

@KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

The error seems to be related to the transformer, so the situation may change if you clone memgpt from git, change the transformer version, and then install it.

I don't quite understand why you think building from git will make a difference - can you expand on that idea?

Sorry for the late reply.

As for my ideas, I'm sorry that they weren't helpful.

The issue was resolved in my environment by upgrading "llama-index-embeddings-huggingface" as already discussed in this issue.

Specifically, it was resolved by the following steps:

pip install 'pymemgpt[local]'==0.3.6

pip install --upgrade llama-index-embeddings-huggingface

In my environment, I checked with pymemgpt version 0.3.6.

Also, in pymemgpt version 0.3.6, "llama-index-embeddings-huggingface" is installed with version 0.1.5, and can be changed by the command "pip install --upgrade llama-index-embeddings-huggingface". , has been upgraded to version 0.2.0.

@sarahwooders sarahwooders self-assigned this Apr 4, 2024
@sarahwooders sarahwooders added the bug Something isn't working label Apr 4, 2024
@sarahwooders
Copy link
Collaborator

I wasn't able to reproduce this error, but am upgrading the llama-index-embeddings-huggingface package and fixed an different bug with the embedding_model not being properly set for the "local" embedding model option.

In general, I'd also recommend using the endpoint provided by memgpt quickstart instead of computing embeddings locally, since the model we're using for local computations has very poor performance.

@github-project-automation github-project-automation bot moved this from To triage to Done in 🐛 MemGPT issue tracker Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
6 participants