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

failed to concatenate document_choice #1630

Closed tomerjr closed 4 months ago

tomerjr commented 4 months ago

Hi, tried to search relevant issues but did not find any. when trying to run --langchain_mode with my db and with --document_choice like so: python generate.py --base_model=https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/resolve/main/zephyr-7b-beta.Q2_K.gguf --prompt_type=zephyr --langchain_mode=Duck --document_choice=[file2.pdf] --hf_embedding_model=sentence-transformers/all-MiniLM-L6-v2 --score_model=None --llamacpp_dict="{'n_gpu_layers':10}" --max_seq_len=1024 --enable_tts=False --enable_stt=False --enable_transcriptions=False

and like so: --document_choice="file2.pdf" --document_choice=["file2.pdf"] --document_choice=file2.pdf

i get the following error:

File "/home/tomershm/h2ogpt/generate.py", line 20, in entrypoint_main() File "/home/tomershm/h2ogpt/generate.py", line 16, in entrypoint_main H2O_Fire(main) File "/home/tomershm/h2ogpt/src/utils.py", line 69, in H2O_Fire fire.Fire(component=component, command=args) File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/fire/core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/fire/core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, kwargs) File "/home/tomershm/h2ogpt/src/gen.py", line 2203, in main go_gradio(locals()) File "/home/tomershm/h2ogpt/src/gradio_runner.py", line 872, in go_gradio docs_state00 = kwargs['document_choice'] + [DocumentChoice.ALL.value] TypeError: can only concatenate str (not "list") to str

I am basically trying to select specific documents to work with after creating a db via make_db. would love some help or clarification on how to use document selection. thank you!

pseudotensor commented 4 months ago

It should look like:

--document_choice="['file2.pdf']"

for Fire to process it into list, the others cause problems in bash command line.

If you are in a different command line, like pycharm, then don't need the extra outer double quotes.