nemo_rl.transformers_compat#
Temporary compatibility patches for supported Transformers releases.
Remove this module and its package bootstrap when NeMo RL requires Transformers 5.13.0 or newer.
Module Contents#
Functions#
Hash dynamic-module sources without losing symlinked snapshot filenames. |
|
Backport the Transformers 5.13 dynamic-module symlink fix. |
Data#
API#
- nemo_rl.transformers_compat.logger#
‘getLogger(…)’
- nemo_rl.transformers_compat._MIN_AFFECTED_TRANSFORMERS_VERSION#
‘5.11.0’
- nemo_rl.transformers_compat._FIXED_TRANSFORMERS_VERSION#
‘5.13.0’
- nemo_rl.transformers_compat._EXPECTED_HASH_FUNCTION_PARAMETERS#
(‘pretrained_model_name_or_path’, ‘resolved_module_file’)
- nemo_rl.transformers_compat._compute_local_source_files_hash_with_symlink_fix(
- pretrained_model_name_or_path: str | os.PathLike,
- resolved_module_file: str | os.PathLike,
Hash dynamic-module sources without losing symlinked snapshot filenames.
Adapted from the implementation shipped upstream in Transformers 5.13.0 by https://github.com/huggingface/transformers/pull/46618. Earlier affected releases resolve snapshot file symlinks into
blobs/before locating relative imports, where blob names no longer have the Python module filenames that those imports reference.
- nemo_rl.transformers_compat._patch_transformers_dynamic_module_symlink_cache() bool[source]#
Backport the Transformers 5.13 dynamic-module symlink fix.
Returns
Trueonly when this call installs the patch. Missing Transformers and unaffected versions are intentional no-ops. Remove this patch after upgrading the minimum supported Transformers version to 5.13.0.