[Bug] `TypeError: got an unexpected keyword argument 'proxies'` when loading TimesFM 2.5 via `from_pretrained`
Description:
When trying to load TimesFM_2p5_200M_torch in a fresh environment (like Google Colab) with the latest huggingface_hub (e.g., v0.26+), the model fails to initialize.
The huggingface_hub passes network-related parameters (like proxies and paper_url) via **kwargs during the from_pretrained call, but the TimesFM_2p5_200M_torch.__init__() method does not accept them, resulting in a TypeError.
Environment:
- OS: Google Colab (Ubuntu)
huggingface_hubversion: 0.26.2 (or latest)transformersversion: 4.46.1timesfminstalled via git (git+https://github.com/google-research/timesfm.git)
Error Traceback:
Traceback (most recent call last):
...
File "/usr/local/lib/python3.12/dist-packages/timesfm/timesfm_2p5/timesfm_2p5_torch.py", line 332, in _from_pretrained
instance = cls(config=config, **model_kwargs)
TypeError: TimesFM_2p5_200M_torch.__init__() got an unexpected keyword argument 'proxies'
# Note: Sometimes it also fails with unexpected keyword argument 'paper_url' during ModelHubMixin initialization.
Proposed Solution:
A simple fix would be to explicitly pop these unexpected network/hub parameters before initialization in timesfm_2p5_torch.py, or simply allow **kwargs in the model's __init__ to safely ignore unused arguments from the Hub.
For example, modifying _from_pretrained in timesfm_2p5_torch.py:
model_kwargs.pop('proxies', None)
model_kwargs.pop('paper_url', None)
instance = cls(config=config, **model_kwargs)
Source: google-research/timesfm