When creating the legacy text generation pipeline, this imports modules from the root transformers folder. This results in chat.py being imported as well, which also imports the legacy text generation pipeline, resulting in a circular import.
This PR moves the chat.py file into a separate folder. This is a temporary fix until we get chat migrated to the new framework
This effect seems to be masked in our tests (such as the legacy tests) based on schemas being imported first but breaks if the schemas are not first imported
Example:
This works fine:
from deepsparse.legacy import Pipeline
from deepsparse.transformers.schemas.text_generation_schemas import TextGenerationOutput
Pipeline.create(task="text_generation", ...)
This does not:
from deepsparse.legacy import Pipeline
Pipeline.create(task="text_generation", ...)
Not obvious to me why the first doesn't cause the same issue with a circular import?
Summary
chat.py
being imported as well, which also imports the legacy text generation pipeline, resulting in a circular import.chat.py
file into a separate folder. This is a temporary fix until we get chat migrated to the new frameworkExample:
This works fine:
This does not:
Not obvious to me why the first doesn't cause the same issue with a circular import?