Clear all registered patch mappings. This removes all registered mappings from the global registry. Example: ```python from transformers.monkey_patching import register_patch_mapping, clear_patch_mapping # Register some patches register_patch_mapping(
()
| 207 | |
| 208 | |
| 209 | def clear_patch_mapping() -> None: |
| 210 | """ |
| 211 | Clear all registered patch mappings. |
| 212 | |
| 213 | This removes all registered mappings from the global registry. |
| 214 | |
| 215 | Example: |
| 216 | ```python |
| 217 | from transformers.monkey_patching import register_patch_mapping, clear_patch_mapping |
| 218 | |
| 219 | # Register some patches |
| 220 | register_patch_mapping( |
| 221 | mapping={"Qwen2MoeExperts": CustomExperts} |
| 222 | ) |
| 223 | |
| 224 | # Clear all patches |
| 225 | clear_patch_mapping() |
| 226 | ``` |
| 227 | """ |
| 228 | global _monkey_patch_mapping_cache |
| 229 | with _monkey_patch_lock: |
| 230 | _monkey_patch_mapping_cache.clear() |
| 231 | |
| 232 | |
| 233 | @contextmanager |