gigachat
gigachat copied to clipboard
Не работает вместе с ragas
Пытаюсь провалидировать колонки датафрейма но выдает ошибку
import pandas as pd
import numpy as np
from langchain.chat_models.gigachat import GigaChat
import pandas as pd
from ragas.embeddings import HuggingfaceEmbeddings
hf_embeddings = HuggingfaceEmbeddings(model_name="e5-large")
df = pd.read_excel('/content/pds_valid_prompts.xlsx')
llm = GigaChat(user = 'user', password = 'password',model='GigaChat-Pro',profanity_check=False, verify_ssl_certs=False)
логи
Exception in thread Thread-11:
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/ragas/executor.py", line 87, in run
results = self.loop.run_until_complete(self._aresults())
File "/usr/lib/python3.10/asyncio/base_events.py", line 625, in run_until_complete
self._check_running()
File "/usr/lib/python3.10/asyncio/base_events.py", line 584, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
/usr/lib/python3.10/threading.py:1018: RuntimeWarning: coroutine 'Runner._aresults' was never awaited
self._invoke_excepthook(self)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.10/dist-packages/ragas/evaluation.py:235: RuntimeWarning: coroutine 'as_completed.<locals>.sema_coro' was never awaited
results = executor.results()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
---------------------------------------------------------------------------
ExceptionInRunner Traceback (most recent call last)
[<ipython-input-2-a7d59fa2e4c4>](https://localhost:8080/#) in <cell line: 13>()
11
12 dataset = Dataset.from_dict(data_samples)
---> 13 score = evaluate(dataset,llm=llm, embeddings = hf_embeddings, raise_exceptions=False, metrics=[answer_relevancy])
14 score.to_pandas()
1 frames
[/usr/local/lib/python3.10/dist-packages/ragas/evaluation.py](https://localhost:8080/#) in evaluate(dataset, metrics, llm, embeddings, callbacks, in_ci, is_async, run_config, raise_exceptions, column_map)
253 evaluation_rm.on_chain_error(e)
254
--> 255 raise e
256 else:
257 result = Result(
[/usr/local/lib/python3.10/dist-packages/ragas/evaluation.py](https://localhost:8080/#) in evaluate(dataset, metrics, llm, embeddings, callbacks, in_ci, is_async, run_config, raise_exceptions, column_map)
235 results = executor.results()
236 if results == []:
--> 237 raise ExceptionInRunner()
238
239 # convert results to dataset_like
ExceptionInRunner: The runner thread which was running the jobs raised an exeception. Read the traceback above to debug it. You can also pass `raise_exceptions=False` incase you want to show only a warning message instead.