Thanks for the great work. I added some QoL changes, feel free to cherrypick or reject this PR altogether if it doesn't suit your needs.
changes:
removed .DS_Store, add .DS_Store to .gitignore
removed logging.basicConfig, because this overrides user settings upon import, which makes the code difficult to integrate into larger projects. (i.e., when I set my own logging, and then import this, I get your logging settings, not mine, which is difficult to debug)
added type hints to all functions
added dataclasses to functions that had dict as a type, which makes for a more pleasant user experience
removed typing imports for built-ins. You indicate that this code is python >= 3.9. From 3.9 onwards, type imports are no longer necessary.
turned (1024 * 1024) into a constant
turned the default model into a private constant
removed the optionals from the initializer, as these arguments were not really optional
didn't initialize the model, tokenizer, and pipeline attributes to None because this makes typing difficult.
The code currently doesn't pass mypy type checking. I didn't go for this because I don't think you actually want this, but I could also add it if you like.
Let me know what you think. Feel free to reject if you think this is overly nitpicky 😊
Hi!
Thanks for the great work. I added some QoL changes, feel free to cherrypick or reject this PR altogether if it doesn't suit your needs.
changes:
logging.basicConfig
, because this overrides user settings upon import, which makes the code difficult to integrate into larger projects. (i.e., when I set my own logging, and then import this, I get your logging settings, not mine, which is difficult to debug)dict
as a type, which makes for a more pleasant user experiencepython >= 3.9
. From 3.9 onwards, type imports are no longer necessary.The code currently doesn't pass
mypy
type checking. I didn't go for this because I don't think you actually want this, but I could also add it if you like.Let me know what you think. Feel free to reject if you think this is overly nitpicky 😊