Skip to content

Conversation

@m0tbka
Copy link

@m0tbka m0tbka commented Nov 19, 2025

Новый пайплайн для извлечения триплетов, основанный на работе нескольких специализированных легковесных моделей.
Ключевые изменения включают:

  • Новый модуль ragu.triplet.pipeline, который управляет всем процессом извлечения.
  • Разделение NLP-задач (NER, RE, NEN, Description) на отдельные микросервисы, определённые в docker-compose.yml.
  • Сервис custom_service для работы с моделью RaguTeam/RAGU-lm.
  • Обновлённую документацию и примеры для демонстрации работы нового пайплайна.

Copy link
Collaborator

@AsphodelRem AsphodelRem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть некоторые замечания по коду. Часть из них пометил, как "на будущее" - можно поправить потом. Но некоторые лучше обсудить и исправить сейчас

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. У нас есть BatchGenerator в ragu/common/batch_generator
  2. Хотелось бы избавиться от магического числа 5 в строке 92 (вынести в параметры)
  3. Зачем нам (по крайней мере в этот момент) relation_type?
  4. Все отношения лучше помечать как relations, а не relationships для консистентности с остальным кодом.
  5. Строки 55-57 лучше переписать, пояснить, чем первый контекст отличается от второго и т.д.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Я так понимаю, здесь transformers используется для инференса ragu-lm? А почему не через vllm? Так ведь быстрее будет.
  2. Тут лучше промпты переиспользовать из ragu/common/prompts (это, скорее, коментарий на будущее)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не ломает ли добавление relationship_type ничего другого в коде? Если нет, то можем оставить

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это ведь уже есть в ragu/common/prompts/default_templates

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это больше замечание к архитектуре классов из pipeline, но я коммент оставлю здесь, т.к. тут наглядно видно, что не нравится.

А в чем ценность создавать пайплайн вот так:

ner_client = NERClient(NER_SERVICE_BASE_URL)
nen_client = NENClient(LLM_BASE_URL)
re_client = REClient(RE_SERVICE_BASE_URL)
description_client = DescriptionClient(LLM_BASE_URL)

# Create the pipeline steps in the correct order
steps = [
    NERStep(ner_client),
    NENStep(nen_client),
    EntityDescriptionStep(description_client),
    REStep(re_client),
    RelationDescriptionStep(description_client),
]

# Create the pipeline
pipeline = Pipeline(steps)

Как будто проще и логичнее сразу передавать url в pipeline, и там заводить экземпляры классов-клиентов (или steps). Вроде клиенты ни от чего, кроме url, не зависят.

Замечание на будущее, пока пусть остается так

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так ли он нам нужен? transformers в проде обычно не используют

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно подумать, как грамотно разнести зависимости по "подпакетам" (или extras). Сейчас есть два типа - дефолтный и local (pip install graph_ragu[local]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants