Skip to content

Conversation

@LeoGrin
Copy link
Collaborator

@LeoGrin LeoGrin commented Aug 5, 2025

…attribute to prevent silent behavior difference with our base model

Motivation and Context


Public API Changes

  • No Public API changes
  • Yes, Public API changes (Details below)

How Has This Been Tested?


Checklist

  • The changes have been tested locally.
  • Documentation has been updated (if the public API or usage changes).
  • A entry has been added to CHANGELOG.md (if relevant for users).
  • The code follows the project's style guidelines.
  • I have considered the impact of these changes on the public API.

Copilot AI review requested due to automatic review settings August 5, 2025 19:53
Copy link
Contributor

@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.

Summary of Changes

Hello @LeoGrin, 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 focuses on enhancing the robustness and predictability of the TabPFNClassifier by introducing explicit error checks for critical model components. My changes ensure that if a model passed to update_encoder_params lacks expected attributes like encoder or remove_outliers on its normalization layer, an immediate ValueError is raised. This prevents silent failures or divergent behavior, making the system more reliable and easier to debug.

Highlights

  • Improved Error Handling: I've updated the update_encoder_params function in src/tabpfn/utils.py to explicitly raise a ValueError if the provided model object does not possess an encoder attribute. Previously, the function would silently return, potentially leading to unexpected behavior or silent differences in TabPFNClassifier.
  • Enhanced Robustness: Within the same update_encoder_params function, I've added another validation step. It now checks if the identified InputNormalizationEncoderStep object has a remove_outliers attribute. If this critical attribute is missing, a ValueError is raised, preventing potential runtime errors when attempting to modify it.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 or fill out our survey to provide feedback.

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
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds validation to the update_encoder_params function to ensure the model has the required encoder and normalization layer attributes. Instead of silently returning when the model lacks an encoder, it now raises explicit errors to prevent unexpected behavior differences with the base model.

  • Replaces silent return with ValueError when model lacks encoder attribute
  • Adds validation for the remove_outliers attribute on InputNormalizationEncoderStep
  • Includes TODO comment about finding a less hacky approach for setting changes

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@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 improves the robustness of the TabPFN models by adding explicit checks for required attributes on the model and its encoder, raising errors instead of failing silently. This is a valuable change.

My feedback focuses on making the new error messages more generic. Since the update_encoder_params function is a utility shared by both TabPFNClassifier and TabPFNRegressor, the error messages should not be specific to just the classifier. This will improve clarity and maintainability.

@noahho noahho enabled auto-merge (squash) August 6, 2025 06:54
@noahho noahho merged commit c250310 into main Aug 6, 2025
8 checks passed
@LeoGrin LeoGrin deleted the lg-raise-on-missing-encoder-attr branch August 6, 2025 07:59
oscarkey pushed a commit that referenced this pull request Nov 12, 2025
…esn't have encoder … (#93)

* raise an error if the model in TabPFNClassifier doesn't have encoder … (#439)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: noahho <Noah.homa@gmail.com>
(cherry picked from commit c250310)

* Record copied public PR 439

---------

Co-authored-by: LeoGrin <45738728+LeoGrin@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: noahho <Noah.homa@gmail.com>
Co-authored-by: mirror-bot <mirror-bot@users.noreply.github.com>
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.

3 participants