Repository: Marker-Inc-Korea/AutoRAG
Issue: [BUG] RecursionError when Using BAAI/bge-m3 with HuggingFaceEmbedding in AutoRAG Tutorial
Root cause: Resource Mishandling

**Describe the bug**  
When executing the `Evaluator.start_trial` method in the autorag library, a `RecursionError: maximum recursion depth exceeded` occurs. This issue arises specifically when using `HuggingfaceEmbedding` with the `BAAI/bge-m3` model for embedding, following the instructions in the README's "Step 3: Use Custom LLM & Embedding Model | Use Custom Model."

**To Reproduce**  
Steps to reproduce the issue:
1. Create an `Evaluator` object, specifying `qa_data_path`, `corpus_data_path`, and `project_dir`.
2. Call the `evaluator.start_trial` method with a configuration file (`config.yaml`).
3. In the configuration file, set the embedding model to `HuggingfaceEmbedding` with `BAAI/bge-m3`, as described in the README's "Step 3: Use Custom LLM & Embedding Model | Use Custom Model."

**Expected behavior**  
The `Evaluator` should successfully start the QA evaluation using the configuration provided, utilizing `HuggingfaceEmbedding` with the `BAAI/bge-m3` model, and return the evaluation results.

**Full Error Log**  
```
Ingesting VectorDB... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 1/1 0:03:47
Evaluating...         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% 0/3 0:00:03
modules.json: 100%
 349/349 [00:00<00:00, 11.9kB/s]
config_sentence_transformers.json: 100%
 123/123 [00:00<00:00, 6.83kB/s]
README.md: 100%
 15.8k/15.8k [00:00<00:00, 1.01MB/s]
sentence_bert_config.json: 100%
 54.0/54.0 [00:00<00:00, 5.09kB/s]
config.json: 100%
 687/687 [00:00<00:00, 25.7kB/s]
tokenizer_config.json: 100%
 444/444 [00:00<00:00, 19.7kB/s]
sentencepiece.bpe.model: 100%
 5.07M/5.07M [00:00<00:00, 48.7MB/s]
tokenizer.json: 100%
 17.1M/17.1M [00:00<00:00, 44.4MB/s]
special_tokens_map.json: 100%
 964/964 [00:00<00:00, 99.2kB/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]Exception in thread Thread-12:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/formatters.py", line 224, in catch_format_error
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
  0%|          | 0/77 [00:00<?, ?it/s]
    r = method(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/formatters.py", line 909, in __call__
    printer = self.lookup(obj)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/formatters.py", line 392, in lookup
    if obj_id in self.singleton_printers:
  File "/usr/local/lib/python3.10/dist-packages/traitlets/traitlets.py", line 700, in __get__
    return self.get(obj, cls)
RecursionError: maximum recursion depth exceeded
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/dist-packages/rich/live.py", line 32, in run
    self.live.refresh()
  File "/usr/local/lib/python3.10/dist-packages/rich/live.py", line 237, in refresh
    with self.ipy_widget:
  File "/usr/local/lib/python3.10/dist-packages/ipywidgets/widgets/widget_output.py", line 109, in __enter__
    self._flush()
  File "/usr/local/lib/python3.10/dist-packages/ipywidgets/widgets/widget_output.py", line 132, in _flush
    sys.stderr.flush()
  File "/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py", line 53, in flush
    self.__console.print(output)
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 1678, in print
    with self:
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2019, in _check_buffer
    self._write_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2035, in _write_buffer
    display(self._buffer, self._render_buffer(self._buffer[:]))
  File "/usr/local/lib/python3.10/dist-packages/rich/jupyter.py", line 91, in display
    ipython_display(jupyter_renderable)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 327, in display
    publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 119, in publish_display_data
    display_pub.publish(
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 115, in publish
    self._flush_streams()
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 83, in _flush_streams
    sys.stderr.flush()
  File "/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py", line 53, in flush
    self.__console.print(output)
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 1678, in print
    with self:
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2019, in _check_buffer
    self._write_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2035, in _write_buffer
    display(self._buffer, self._render_buffer(self._buffer[:]))
  File "/usr/local/lib/python3.10/dist-packages/rich/jupyter.py", line 91, in display
    ipython_display(jupyter_renderable)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 327, in display
    publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 119, in publish_display_data
    display_pub.publish(
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 115, in publish
    self._flush_streams()
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 83, in _flush_streams
    sys.stderr.flush()
  File "/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py", line 53, in flush
    self.__console.print(output)
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 1678, in print
    with self:
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2019, in _check_buffer
    self._write_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2035, in _write_buffer
    display(self._buffer, self._render_buffer(self._buffer[:]))
  File "/usr/local/lib/python3.10/dist-packages/rich/jupyter.py", line 91, in display
    ipython_display(jupyter_renderable)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 327, in display
    publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 119, in publish_display_data
    display_pub.publish(
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 115, in publish
    self._flush_streams()
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 83, in _flush_streams
    sys.stderr.flush()
  File "/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py", line 53, in flush
    self.__console.print(output)
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 1678, in print
    with self:
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2019, in _check_buffer
    self._write_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2035, in _write_buffer
    display(self._buffer, self._render_buffer(self._buffer[:]))
  File "/usr/local/lib/python3.10/dist-packages/rich/jupyter.py", line 91, in display
    ipython_display(jupyter_renderable)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 327, in display
    publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 119, in publish_display_data
    display_pub.publish(
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 115, in publish
    self._flush_streams()
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 83, in _flush_streams
    sys.stderr.flush()
  File "/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py", line 53, in flush
    self.__console.print(output)
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 1678, in print
    with self:
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2019, in _check_buffer
    self._write_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2035, in _write_buffer
    display(self._buffer, self._render_buffer(self._buffer[:]))
  File "/usr/local/lib/python3.10/dist-packages/rich/jupyter.py", line 91, in display
    ipython_display(jupyter_renderable)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 327, in display
    publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/display.py", line 119, in publish_display_data
    display_pub.publish(
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 115, in publish
    self._flush_streams()
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 83, in _flush_streams
    sys.stderr.flush()
  File "/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py", line 53, in flush
    self.__console.print(output)
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 1678, in print
    with self:
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 822, in _exit_buffer
---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/IPython/core/formatters.py](https://localhost:8080/#) in catch_format_error(method, self, *args, **kwargs)
    223     try:
--> 224         r = method(self, *args, **kwargs)
    225     except NotImplementedError:

28 frames
RecursionError: maximum recursion depth exceeded

During handling of the above exception, another exception occurred:

RecursionError                            Traceback (most recent call last)
... last 11 frames repeated, from the frame below ...

[/usr/local/lib/python3.10/dist-packages/rich/file_proxy.py](https://localhost:8080/#) in flush(self)
     51         output = "".join(self.__buffer)
     52         if output:
---> 53             self.__console.print(output)
     54         del self.__buffer[:]
     55 

RecursionError: maximum recursion depth exceeded in __instancecheck__
    self._check_buffer()
  File "/usr/local/lib/python3.10/dist-packages/rich/console.py", line 2019, in _check_buffer
    self._write_buffer()
```

**Code where the bug occurred**  

```python
import autorag
from autorag import LazyInit
from llama_index.embeddings.huggingface import HuggingFaceEmbedding

autorag.embedding_models['upstage'] = LazyInit(HuggingFaceEmbedding, model_name="BAAI/bge-m3")
```

```python
from autorag.evaluator import Evaluator

evaluator = Evaluator(
    qa_data_path='/content/eli5_data/qa_sample.parquet', 
    corpus_data_path='/content/eli5_data/corpus_sample.parquet',
    project_dir='/content/project_dir'
)

evaluator.start_trial('/content/config.yaml')
```

**AutoRAG YAML file (config.yaml):**  

```yaml
%%writefile config.yaml
vectordb:
  - name: chroma_upstage
    db_type: chroma
    client_type: persistent
    collection_name: upstage
    embedding_model: upstage
    path: ${PROJECT_DIR}/resources/chroma
node_lines:
- node_line_name: retrieve_node_line
  nodes:
    - node_type: retrieval
      strategy:
        metrics: [retrieval_f1, retrieval_recall, retrieval_ndcg, retrieval_mrr]
      top_k: 3
      modules:
        - module_type: vectordb
          vectordb: chroma_upstage
        - module_type: bm25
        - module_type: hybrid_rrf
          weight_range: (4,80)
- node_line_name: post_retrieve_node_line
  nodes:
    - node_type: prompt_maker
      strategy:
        metrics:
          - metric_name: meteor
          - metric_name: rouge
          - metric_name: sem_score
            embedding_model: upstage # Use upstage embedding model
      modules:
        - module_type: fstring
          prompt: "Read the passages and answer the given question. \n Question: {query} \n Passage: {retrieved_contents} \n Answer : "
    - node_type: generator
      strategy:
        metrics:
          - metric_name: meteor
          - metric_name: rouge
          - metric_name: sem_score
            embedding_model: upstage # Use upstage embedding model
      modules:
        - module_type: llama_index_llm
          llm: upstage  # Use upstage LLM
          batch: 4
```

**Desktop (please complete the following information):**
- OS: Linux
- Python version: 3.10

**Additional context**  
I used **Step 3: Use Custom LLM & Embedding Model | Use Custom Model** from the Colab Tutorial provided in your README.md, and in this step, I only modified the following code:

```python
import autorag
from autorag import LazyInit
from llama_index.embeddings.upstage import UpstageEmbedding

autorag.embedding_models['upstage'] = LazyInit(UpstageEmbedding, model_name="solar-embedding-1-large")
```

to

```python
import autorag
from autorag import LazyInit
from llama_index.embeddings.huggingface import HuggingFaceEmbedding

autorag.embedding_models['upstage'] = LazyInit(HuggingFaceEmbedding, model_name="BAAI/bge-m3")
```

@jjaegii Hello! I will look into this issue. Thanks for reporting the bug.

@jjaegii 
Hi, it looks like you tried to use BAAI-bge embedding model but the config YAML file and code in the colab demo is upstage API model. 
Can you check the [docs](https://docs.auto-rag.com/local_model.html#configure-the-embedding-model) and tutorial to change this to BAAI bge model?
 

I reviewed the documentation and modified the code and YAML as follows, but the same error still occurs.

```python
import autorag
from autorag import LazyInit
from llama_index.embeddings.huggingface import HuggingFaceEmbedding

autorag.embedding_models['huggingface_bge_m3'] = LazyInit(HuggingFaceEmbedding, model_name="BAAI/bge-m3")
```

```yaml
%%writefile config.yaml
vectordb:
  - name: chroma_upstage
    db_type: chroma
    client_type: persistent
    collection_name: huggingface_bge_m3
    embedding_model: huggingface_bge_m3
    path: ${PROJECT_DIR}/resources/chroma
node_lines:
- node_line_name: retrieve_node_line
  nodes:
    - node_type: retrieval
      strategy:
        metrics: [retrieval_f1, retrieval_recall, retrieval_ndcg, retrieval_mrr]
      top_k: 3
      modules:
        - module_type: vectordb
          vectordb: chroma_upstage
        - module_type: bm25
        - module_type: hybrid_rrf
          weight_range: (4,80)
- node_line_name: post_retrieve_node_line
  nodes:
    - node_type: prompt_maker
      strategy:
        metrics:
          - metric_name: meteor
          - metric_name: rouge
          - metric_name: sem_score
            embedding_model: huggingface_bge_m3
      modules:
        - module_type: fstring
          prompt: "Read the passages and answer the given question. \n Question: {query} \n Passage: {retrieved_contents} \n Answer : "
    - node_type: generator
      strategy:
        metrics:
          - metric_name: meteor
          - metric_name: rouge
          - metric_name: sem_score
            embedding_model: huggingface_bge_m3 
      modules:
        - module_type: llama_index_llm
          llm: upstage  # Use upstage LLM
          batch: 4
```

Could you please advise if there are any additional configurations or adjustments needed to resolve this issue? Thank you for your assistance.

Additionally, using the provided **AutoRAG Tutorial 3 - Use Custom LLM & Embedding Model.ipynb** file exactly as-is with the default `upstage llm` and `upstage embedding model` also results in the same error.

Any additional guidance or advice on resolving this issue would be greatly appreciated. Thank you.

@jjaegii Thank you! We will fix that ASAP. 

I resolve the Upstage Error about `openai_truncate_by_token` and merged.
But still have recursion error. 
Thanks for reporting us.

@bwook00 The problem occured becuase of the rich progress.
I will add option to disable track of the progress for colab environment

We fixed this at v0.3.9
Thank you very much!!