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

[Feature request] Custom models #1

Open
GHuserE opened this issue Apr 27, 2024 · 4 comments
Open

[Feature request] Custom models #1

GHuserE opened this issue Apr 27, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@GHuserE
Copy link

GHuserE commented Apr 27, 2024

Hello there!

Is it possible to add a feature such that one can add custom models for feature extraction? The donut model is not that accurate and I do not have the hardware for Idefics2. I have 8GB RAM, no GPU.

@CopperEagle
Copy link
Owner

Hey @GHuserE

Yes, this should be no problem.

A custom method for document metadata extraction (excluding keywords) can be implemented by extending the BaseDocumentClass. This extended class does the loading of the model and provides get_title, get_publisher and get_publishing_year. For the latter methods, you can assume self.image contains the image for the first page of the document. A good example is here.

However, I still need to add a method to DatabaseInterface that allows you to register this new class from outside the library.

If you have any specific model in mind, you can also send me a message. If the model provides good performance for the resources it needs, I can add it to the library.

@CopperEagle CopperEagle self-assigned this May 1, 2024
@CopperEagle CopperEagle added the enhancement New feature or request label May 1, 2024
@GHuserE
Copy link
Author

GHuserE commented May 9, 2024

I want to use Moondream2. It's friggin' good and can run locally and is fast. Thanks!

@CopperEagle
Copy link
Owner

Hey there

Thank you for the tip. I already have the model on my radar. It is indeed quite remarkable and also steerable enough. There are some other small models that write long elaborations on how they derive the title rather than just returning the answer - no matter how much you ask them not to (they like their flow, don't they) 😆. It may take some time before I add it, though... Please stand by 😃

@CopperEagle
Copy link
Owner

CopperEagle commented May 19, 2024

Okay @GHuserE the Moondream2 model is now available since a87135b. You can use it by setting

db.set_metadata_method(MOONDREAM2)

About adding custom models: I am going to work on reorganizing the code, e.g. by storing all prompts in a single place. This should help it being able to scale better with supporting more models and also remote APIs (ChatGPT, etc.). Please stand by.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants