Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running default.config.yml returns TypeError: register() got an unexpected keyword argument 'ids' #256

Closed
luquitared opened this issue Apr 4, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@luquitared
Copy link

luquitared commented Apr 4, 2022

Hi. Checking this project out and excited to get the API running. I set up a docker instance with the official txtai-cpu container and used the default config.yml from the docs to start the process. Here is the config:

# Index file path
path: /tmp/index

# Allow indexing of documents
writable: True

# Enbeddings index
embeddings:
  path: sentence-transformers/nli-mpnet-base-v2

# Extractive QA
extractor:
  path: distilbert-base-cased-distilled-squad

# Zero-shot labeling
labels:

# Similarity
similarity:

# Text segmentation
segmentation:
    sentences: true

# Text summarization
summary:

# Text extraction
textractor:
    paragraphs: true
    minlength: 100
    join: true

# Transcribe audio to text
transcription:

# Translate text between languages
translation:

# Workflow definitions
workflow:
    sumfrench:
        tasks:
            - action: textractor
              task: storage
              ids: false
            - action: summary
            - action: translation
              args: ["fr"]
    sumspanish:
        tasks:
            - action: textractor
              task: url
            - action: summary
            - action: translation
              args: ["es"]

I attempt to run the service using this command:

CONFIG=config.yml uvicorn "txtai.api:app"

things appear normal, and models are downloaded from hugginface. After they download I am presented with this error:

ERROR:    Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 621, in lifespan
    async with self.lifespan_context(app):
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 518, in __aenter__
    await self._router.startup()
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 600, in startup
    handler()
  File "/usr/local/lib/python3.8/dist-packages/txtai/api/application.py", line 67, in start
    INSTANCE = Factory.create(config, api) if api else API(config)
  File "/usr/local/lib/python3.8/dist-packages/txtai/api/base.py", line 18, in __init__
    super().__init__(config, loaddata)
  File "/usr/local/lib/python3.8/dist-packages/txtai/app/base.py", line 70, in __init__
    self.flows()
  File "/usr/local/lib/python3.8/dist-packages/txtai/app/base.py", line 134, in flows
    self.workflows[workflow] = WorkflowFactory.create(config, workflow)
  File "/usr/local/lib/python3.8/dist-packages/txtai/workflow/factory.py", line 31, in create
    tasks.append(TaskFactory.create(tconfig, task))
  File "/usr/local/lib/python3.8/dist-packages/txtai/workflow/task/factory.py", line 63, in create
    return TaskFactory.get(task)(**config)
  File "/usr/local/lib/python3.8/dist-packages/txtai/workflow/task/base.py", line 53, in __init__
    self.register(**kwargs)
TypeError: register() got an unexpected keyword argument 'ids'

2022-04-04 04:21:38,422 [ERROR] send: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 621, in lifespan
    async with self.lifespan_context(app):
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 518, in __aenter__
    await self._router.startup()
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 600, in startup
    handler()
  File "/usr/local/lib/python3.8/dist-packages/txtai/api/application.py", line 67, in start
    INSTANCE = Factory.create(config, api) if api else API(config)
  File "/usr/local/lib/python3.8/dist-packages/txtai/api/base.py", line 18, in __init__
    super().__init__(config, loaddata)
  File "/usr/local/lib/python3.8/dist-packages/txtai/app/base.py", line 70, in __init__
    self.flows()
  File "/usr/local/lib/python3.8/dist-packages/txtai/app/base.py", line 134, in flows
    self.workflows[workflow] = WorkflowFactory.create(config, workflow)
  File "/usr/local/lib/python3.8/dist-packages/txtai/workflow/factory.py", line 31, in create
    tasks.append(TaskFactory.create(tconfig, task))
  File "/usr/local/lib/python3.8/dist-packages/txtai/workflow/task/factory.py", line 63, in create
    return TaskFactory.get(task)(**config)
  File "/usr/local/lib/python3.8/dist-packages/txtai/workflow/task/base.py", line 53, in __init__
    self.register(**kwargs)
TypeError: register() got an unexpected keyword argument 'ids'

ERROR:    Application startup failed. Exiting.
2022-04-04 04:21:38,424 [ERROR] startup: Application startup failed. Exiting.
root@b2e263bd2b88:~/app# 

I attempted this after on my local machine and reproduced the same results.

Any thoughts? Thanks!

@davidmezzetti
Copy link
Member

Thank you for giving txtai a try and reporting the issue. You have identified an error in the documentation!

The issue in the file is this:

workflow:
    sumfrench:
        tasks:
            - action: textractor
              task: storage
              ids: false

It should be:

workflow:
    sumfrench:
        tasks:
            - action: textractor
              task: url

Full correct config.yml:

# Index file path
path: /tmp/index

# Allow indexing of documents
writable: True

# Enbeddings index
embeddings:
  path: sentence-transformers/nli-mpnet-base-v2

# Extractive QA
extractor:
  path: distilbert-base-cased-distilled-squad

# Zero-shot labeling
labels:

# Similarity
similarity:

# Text segmentation
segmentation:
    sentences: true

# Text summarization
summary:

# Text extraction
textractor:
    paragraphs: true
    minlength: 100
    join: true

# Transcribe audio to text
transcription:

# Translate text between languages
translation:

# Workflow definitions
workflow:
    sumfrench:
        tasks:
            - action: textractor
              task: url
            - action: summary
            - action: translation
              args: ["fr"]
    sumspanish:
        tasks:
            - action: textractor
              task: url
            - action: summary
            - action: translation
              args: ["es"]

I will update the documentation to reflect this, thank you and please let me know if you have further questions!

@davidmezzetti davidmezzetti self-assigned this Apr 9, 2022
@davidmezzetti davidmezzetti added this to the v4.4.0 milestone Apr 9, 2022
@davidmezzetti davidmezzetti added the bug Something isn't working label Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants