Skip to content

Conversation

@mohsinm-dev
Copy link

Summary

Fixes AttributeError when TQDM_DISABLE=1 is set before importing orbit. The issue occurs because cmdstanpy assumes tqdm progress bars have a 'postfix' attribute, but disabled tqdm objects don't have this attribute.

Changes

  • Add orbit/utils/cmdstanpy_compat.py with safe progress hook implementation
  • Apply compatibility patch in orbit/estimators/stan_estimator.py when TQDM_DISABLE=1
  • Add comprehensive test coverage for all scenarios

Test Plan

  • Reproduced original issue with TQDM_DISABLE=1
  • Verified fix resolves the AttributeError
  • Added unit tests covering normal and edge cases
  • Tested with actual orbit models to ensure no regressions

Closes #887

- Add cmdstanpy_compat.py with patch_tqdm_progress_hook() function
- Patch cmdstanpy progress hooks to safely handle disabled tqdm objects
- Apply patch in stan_estimator.py when TQDM_DISABLE=1 is set
- Add comprehensive test suite covering all scenarios

Fixes uber#887
@CLAassistant
Copy link

CLAassistant commented Sep 24, 2025

CLA assistant check
All committers have signed the CLA.

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.

Exception: 'tqdm_asyncio' object has no attribute 'postfix'

2 participants