Skip to content

Conversation

@ryuichi-ichinose
Copy link

@ryuichi-ichinose ryuichi-ichinose commented Dec 11, 2025

Description of changes:
Fix reproducibility: save base model revision in adapter_config
The Problem Currently, fit() does not propagate the base model's revision to the LoraConfig. As a result, adapter_config.json is saved without the revision. When loading this adapter later, it silently defaults to the main branch of the base model. If the base model updates, the adapter becomes incompatible or produces different results, breaking reproducibility.
Even if the base model receives minimal or infrequent updates, explicit versioning is strictly necessary.

Key changes:
-Pipeline: explicitly store revision in Chronos2Pipeline instance variables.
-Loading: pass revision to the constructor in from_pretrained.
-Training: inject self.revision into LoraConfig during fit().

Impact:
adapter_config.json will now correctly persist the base model revision. This guarantees that AutoGluon can reproduce the exact model state.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Description:
This commit fixes a critical issue where the base model's revision was failing to be recorded in `adapter_config.json` during LoRA fine-tuning.
Previously, `fit()` did not propagate the loaded model's revision to `LoraConfig`, resulting in the `revision` field being missing or None in the saved adapter configuration.

This omission meant that loading the saved adapter would silently default to the `main` branch of the base model, rather than the specific revision used during training,
 breaking reproducibility.

Key changes:
* Persist Revision: Store the `revision` passed to `from_pretrained` in `model.config._source_revision`.
* Propagate to Config: Update `fit()` to inject this stored revision into `LoraConfig` so it is correctly saved in `adapter_config.json`.
* Validate Integrity: Raise `ValueError` if an explicit `revision` argument in `fit()` conflicts with the loaded model's source revision.

Impact:
EEnsures that adapter_config.json always contains the correct base model revision.
This guarantees that AutoGluon can faithfully reproduce the model state by simply loading the adapter,
without risking a silent version mismatch, even in scenarios where the base model receives minimal or infrequent updates.
@ryuichi-ichinose ryuichi-ichinose marked this pull request as draft December 12, 2025 13:58
@ryuichi-ichinose ryuichi-ichinose marked this pull request as ready for review December 12, 2025 14:38
@ryuichi-ichinose ryuichi-ichinose marked this pull request as draft December 13, 2025 07:33
@ryuichi-ichinose ryuichi-ichinose marked this pull request as ready for review December 13, 2025 07:38
@ryuichi-ichinose
Copy link
Author

autogluon/autogluon#5458

@abdulfatir
Copy link
Contributor

@ryuichi-ichinose Thanks for the PR. I understand the problem and I have some comments.

  • We do not plan to change the model checkpoints on our official repos, so there will never be a "revision" that you should worry about.
  • With the above in mind, I think having a fine-tune of custom revision is a very specific use case which users of the official repos will not run into. from_pretrained provides some convenience for handling the majority of use cases. For cases not covered here, I would recommend loading the base model manually and merging it with the adapter.

I am happy to hear your opinions on why you think this feature is important.

@abdulfatir
Copy link
Contributor

Related: huggingface/peft#1658

@ryuichi-ichinose
Copy link
Author

@abdulfatir Reproducibility is the cornerstone of both research and production, and it is proven by data integrity—not by "plans."

@ryuichi-ichinose
Copy link
Author

@abdulfatir Even if updates are effectively non-existent, my argument is not about the fear of updates, but about the explicit definition of integrity.
Following my previous work on revision pinning in AutoGluon, I noticed that Chronos2 lacked this mechanism. I submitted this PR to ensure consistency and reliability across the ecosystem.
I simply want to enable Chronos2 to pass the argument that was already merged in huggingface/peft#1658.
I do not distrust you. I simply trust nothing but the hash.
We saw the consequences of implicit trust in November 2025, when Shai Hulud 2.0 compromised thousands of repositories. Pinning the revision is not a "special edge case"—it is an operational necessity for supply chain security.

Since this is an optional argument, it adds zero friction for casual users. Furthermore, allowing users to specify the revision effectively offloads the responsibility of version management from you to us.

However, if you still don't trust this approach, then just close the PR.

@abdulfatir
Copy link
Contributor

abdulfatir commented Dec 17, 2025

@ryuichi-ichinose Thanks for your POV. We need to test a few things before we merge this, so this likely won't be part of the next release. If versioning is a issue for you at the moment, I would recommend downloading the model from HF and using a local path. That way, you won't need to worry about potential problems upstream.

@ryuichi-ichinose
Copy link
Author

@abdulfatir OK. I got it.

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.

2 participants