oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.65k stars 5.31k forks source link

Superboogav2 Notebook Issue #5704

Closed MB7979 closed 6 months ago

MB7979 commented 8 months ago

Describe the bug

After the recent changes in this commit Superboogav2 doesn't work for me in Notebook mode. Traceback provided below. It does work in chat and chat instruct, however.

After doing some research I seem to have resolved it by editing notebook_handler.py to add import pytextrank. I'm not sure if this is the best way to resolve this but it did get it working for me.

Is there an existing issue for this?

Reproduction

  1. Install requirements for the extension superboogav2 and load text-gen with the extension enabled.
  2. Attempt to run a query with superboogav2 in Notebook mode.
  3. Receive error: "ValueError: [E002] Can't find factory for 'textrank' for language English (en). This usually happens when spaCy calls nlp.create_pipe with a custom component name that's not registered on the current language class. If you're using a custom component, make sure you've added the decorator @Language.component (for function components) or @Language.factory (for class components)."

Screenshot

No response

Logs

Traceback (most recent call last):
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/queueing.py", line 407, in call_prediction
    output = await route_utils.call_process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/route_utils.py", line 226, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/blocks.py", line 1550, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/blocks.py", line 1199, in call_function
    prediction = await utils.async_iteration(iterator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/utils.py", line 519, in async_iteration
    return await iterator.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/utils.py", line 512, in __anext__
    return await anyio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/utils.py", line 495, in run_sync_iterator_async
    return next(iterator)
           ^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/gradio/utils.py", line 649, in gen_wrapper
    yield from f(*args, **kwargs)
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/modules/text_generation.py", line 189, in generate_reply_wrapper
    for reply in generate_reply(question, state, stopping_strings, is_chat=False, escape_html=True, for_ui=True):
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/modules/text_generation.py", line 33, in generate_reply
    for result in _generate_reply(*args, **kwargs):
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/modules/text_generation.py", line 63, in _generate_reply
    question = apply_extensions('input', question, state)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/modules/extensions.py", line 231, in apply_extensions
    return EXTENSION_MAP[typ](*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/modules/extensions.py", line 89, in _apply_string_extensions
    text = func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/extensions/superboogav2/script.py", line 173, in input_modifier
    return input_modifier_internal(string, collector, is_chat)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/extensions/superboogav2/notebook_handler.py", line 31, in input_modifier_internal
    user_input = preprocess_text(user_input)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/extensions/superboogav2/data_processor.py", line 51, in preprocess_text
    important_sentences = TextSummarizer.process_long_text(text, parameters.get_min_num_sentences())
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/extensions/superboogav2/data_preprocessor.py", line 180, in process_long_text
    nlp_pipeline = TextSummarizer._load_nlp_pipeline()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dandm/TextGenMarchRAG/text-generation-webui/extensions/superboogav2/data_preprocessor.py", line 160, in _load_nlp_pipeline
    TextSummarizer._nlp_pipeline.add_pipe("textrank", last=True)
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/spacy/language.py", line 821, in add_pipe
    pipe_component = self.create_pipe(
                     ^^^^^^^^^^^^^^^^^
  File "/home/dandm/miniconda3/envs/TextGenMarchRAG/lib/python3.11/site-packages/spacy/language.py", line 690, in create_pipe
    raise ValueError(err)
ValueError: [E002] Can't find factory for 'textrank' for language English (en). This usually happens when spaCy calls `nlp.create_pipe` with a custom component name that's not registered on the current language class. If you're using a custom component, make sure you've added the decorator `@Language.component` (for function components) or `@Language.factory` (for class components).

Available factories: attribute_ruler, tok2vec, merge_noun_chunks, merge_entities, merge_subtokens, token_splitter, doc_cleaner, parser, beam_parser, lemmatizer, trainable_lemmatizer, entity_linker, entity_ruler, tagger, morphologizer, ner, beam_ner, senter, sentencizer, spancat, spancat_singlelabel, span_finder, future_entity_ruler, span_ruler, textcat, textcat_multilabel, en.lemmatizer

System Info

Ubuntu, Nvidia 3090x3.
github-actions[bot] commented 6 months ago

This issue has been closed due to inactivity for 2 months. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.