Instructions to use AbdulElahGwaith/transformers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbdulElahGwaith/transformers with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbdulElahGwaith/transformers", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download tests/utils/test_import_utils.py from AbdulElahGwaith/transformers: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/tests/utils/test_import_utils.py
- Command line
-
hf download hf://AbdulElahGwaith/transformers/tests/utils/test_import_utils.py
-
curl -L -o test_import_utils.py https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/tests/utils/test_import_utils.py
1 kB
| import sys | |
| from transformers.testing_utils import run_test_using_subprocess | |
| from transformers.utils.import_utils import clear_import_cache | |
| def test_clear_import_cache(): | |
| """Test the clear_import_cache function.""" | |
| # Save initial state | |
| initial_modules = {name: mod for name, mod in sys.modules.items() if name.startswith("transformers.")} | |
| assert len(initial_modules) > 0, "No transformers modules loaded before test" | |
| # Execute clear_import_cache() function | |
| clear_import_cache() | |
| # Verify modules were removed | |
| remaining_modules = {name: mod for name, mod in sys.modules.items() if name.startswith("transformers.")} | |
| assert len(remaining_modules) < len(initial_modules), "No modules were removed" | |
| # Import and verify module exists | |
| from transformers.models.auto import modeling_auto | |
| assert "transformers.models.auto.modeling_auto" in sys.modules | |
| assert modeling_auto.__name__ == "transformers.models.auto.modeling_auto" | |