Skip to content

Conversation

@Tohrusky
Copy link
Member

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Tohrusky, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily enhances the flexibility and maintainability of the cccv library by introducing **kwargs to several key function signatures, particularly within the AutoConfig, AutoModel, and CCBaseModel classes. This change allows for more dynamic and extensible argument passing, accommodating future requirements without breaking existing interfaces. Concurrently, the PR includes a significant cleanup of import statements across the codebase, removing redundant noqa directives and adjusting linting configurations to improve code quality. Minor updates to module metadata, including licensing and versioning, are also part of this update.

Highlights

  • Function Signature Flexibility: The from_pretrained methods in AutoConfig and AutoModel, as well as from_config in AutoModel, have been updated to accept **kwargs. This allows for passing arbitrary keyword arguments, enhancing the flexibility and extensibility of these functions.
  • Base Model Initialization: The __init__ method of CCBaseModel now also accepts **kwargs, providing more flexibility during model instantiation. Additionally, the inference method in CCBaseModel is no longer marked as an abstract method, making it a concrete method that can be directly implemented or overridden.
  • Import Statement Cleanup and Linting: Numerous noqa comments related to unused imports (F401) have been removed across various __init__.py files (cccv/__init__.py, cccv/arch/__init__.py, cccv/auto/__init__.py, cccv/config/__init__.py, cccv/model/__init__.py, cccv/type/__init__.py, cccv/vs/__init__.py). The pyproject.toml configuration for ruff has been updated to explicitly ignore F401, streamlining the linting process. Several files also received isort: skip_file directives.
  • Module Metadata and Licensing: The main cccv/__init__.py file has been updated to include a full MIT license header and a __version__ string, improving the project's metadata and legal clarity.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates several function signatures to accept **kwargs, which is a good step towards a more flexible API. However, in several places, these **kwargs are not used, which can be misleading. I've left comments on these specific instances.

Additionally, I've noticed a couple of changes that could be improved:

  • The BaseModelInterface.__call__ method change introduces boilerplate for subclasses.
  • The linter configuration for unused imports (F401) has been disabled globally, which is generally not recommended.

I've provided suggestions on how to address these points. The other changes, like cleaning up imports, look good.

@Tohrusky
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates several function signatures to accept **kwargs, increasing API flexibility. The changes are mostly well-implemented, passing **kwargs down the call stack where appropriate. However, there are a few instances where **kwargs is added to a function signature but remains unused, which can be misleading. I've pointed these out. Additionally, there's a breaking change in BaseModelInterface that removes a useful default implementation for __call__, which I recommend reconsidering. The PR also includes code cleanup, like removing # noqa comments, which is enabled by new linter configurations in pyproject.toml.


def __call__(self, *args: Any, **kwargs: Any) -> Any:
return self.inference(*args, **kwargs)
raise NotImplementedError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Changing the implementation of __call__ to raise NotImplementedError from return self.inference(*args, **kwargs) is a significant breaking change for the BaseModelInterface. The previous implementation provided a useful default behavior, making any object that implements inference callable. Now, every subclass must explicitly implement __call__, often with the same boilerplate code that was just removed (return self.inference(*args, **kwargs)), as seen in CCBaseModel. This reduces code reusability and could break other classes that implement this interface and relied on the default __call__ behavior. It's recommended to revert this change to maintain a more robust and developer-friendly interface.

Suggested change
raise NotImplementedError
return self.inference(*args, **kwargs)

Comment on lines +9 to +12
def from_pretrained(
pretrained_model_name: Union[ConfigType, str],
**kwargs: Any,
) -> Any:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The **kwargs parameter is added to the function signature but is not used within the function body, which simply returns CONFIG_REGISTRY.get(pretrained_model_name). This can be misleading for users of this method, as it suggests that additional arguments can be passed, but they will be silently ignored. Please consider either using these arguments, removing them if they are not needed, or at least documenting that they are ignored and perhaps logging a warning if they are provided.

progress: bool = True,
model_dir: Optional[str] = None,
gh_proxy: Optional[str] = None,
**kwargs: Any,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The **kwargs parameter is added to the function signature but is not used within the function body. This can be misleading for users of this function. If the intention is to allow for future extensions, this should be documented in the docstring. Otherwise, it should be removed to avoid confusion. Currently, all call sites within the project call this function without any extra keyword arguments.

pad_img: Optional[Tuple[int, int]] = None,
model_dir: Optional[str] = None,
gh_proxy: Optional[str] = None,
**kwargs: Any,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The **kwargs parameter is added to the __init__ method but is not used within this base class. While this is a common pattern to allow subclasses to receive their own specific arguments, it's good practice to update the docstring to clarify that **kwargs are for subclass-specific parameters. This improves clarity for developers using or extending this class.

@Tohrusky Tohrusky merged commit ef717dc into EutropicAI:main Sep 25, 2025
9 of 12 checks passed
@codecov
Copy link

codecov bot commented Sep 25, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant