Search code examples
h2oopenai-api

H2oGPT - cannot import name 'set_seed'


I'm stuck with H2oGPT, I can't let it run.

I am running on a Windows PC with

  • 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz
  • 32GB memory 64bit
  • GPU Nvidia GeForce RTX 3050

I followed all the procedure described in the H2oGPT Windows Installation Page.

This is the command I launch.

$ python generate.py --base_model='llama' --prompt_type=llama2 --score_model=None --langchain_mode='UserData' --user_path=./my_documents

This is the error stack trace:

Traceback (most recent call last):
  File "C:\Users\dulcin\Documents\Java\UltraGPT\h2ogpt\generate.py", line 7, in <module>
    from src.gen import main
  File "C:\Users\dulcin\Documents\Java\UltraGPT\h2ogpt\src\gen.py", line 32, in <module>
    from utils import set_seed, clear_torch_cache, NullContext, wrapped_partial, EThread, get_githash, \
ImportError: cannot import name 'set_seed' from 'utils' (C:\Users\dulcin\AppData\Local\Programs\Python\Python310\lib\site-packages\utils\__init__.py)

My questions are:

  1. Should I install "utils" seaprately?
  2. Is my laynch command ok? ./my_documents right now only contains one text document.

Solution

  • Here is a suggestion:

    pseudotensor commented 3 days ago • Looks like you have a package "utils" installed and it's looking there instead of the local code.

    Maybe try:

    setenv PYTHONPATH=.:src:$PYTHONPATH

    python generate.py ...

    Here is the link to the same issue: https://github.com/h2oai/h2ogpt/issues/622#issuecomment-1666898436