Closed fcakyon closed 3 weeks ago
This pull request makes torch, transformers, and spacy optional dependencies by modifying import statements and type annotations. The changes aim to improve the package's flexibility and reduce unnecessary dependencies for users who don't need specific features.
classDiagram
class KeywordExtractor {
+list~str~ keywords
+spacy.Language nlp
+set~str~ lemmatized_keywords
+__init__(keywords: list~str~)
}
class FeatureModel {
+AutoFeatureExtractor extractor
+ResNetModel model
+build_feature_model(model_str: str)
}
KeywordExtractor --> spacy: uses
FeatureModel --> transformers: uses
Change | Details | Files |
---|---|---|
Modified type annotation for torch.Tensor |
|
video_sampler/gating.py |
Made spacy an optional import |
|
video_sampler/language/keyword_capture.py |
Made transformers an optional import |
|
video_sampler/visualisation/clustering.py |
Thanks a lot @fcakyon. I'll use this PR to bump the version and add missing base requirements as well
@sourcery-ai review
Hi @LemurPwned! 👋
Only authors and team members can run @sourcery-ai commands on public repos.
Thanks again @fcakyon for your contribution!
@LemurPwned thanks for your fast response 🙏🏻
fixes https://github.com/LemurPwned/video-sampler/issues/29 cc: @LemurPwned
Summary by Sourcery
Make torch, transformers, pysrt and spacy optional dependencies by moving their imports inside the functions that require them, reducing the need for these packages unless their specific functionality is used.
Enhancements: