Spaces:
Build error
Build error
Download captum/log/__init__.py from markytools/strexp: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/markytools/strexp/resolve/main/captum/log/__init__.py
- Command line
-
hf download hf://spaces/markytools/strexp/captum/log/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/markytools/strexp/resolve/main/captum/log/__init__.py
1.03 kB
| #!/usr/bin/env python3 | |
| try: | |
| from captum.log.fb.internal_log import ( | |
| log, | |
| log_usage, | |
| patch_methods, | |
| set_environment, | |
| TimedLog, | |
| ) | |
| __all__ = ["log", "log_usage", "TimedLog", "set_environment"] | |
| except ImportError: | |
| from functools import wraps | |
| def log(*args, **kwargs): | |
| pass | |
| # bug with mypy: https://github.com/python/mypy/issues/1153 | |
| class TimedLog: # type: ignore | |
| def __init__(self, *args, **kwargs): | |
| pass | |
| def __enter__(self): | |
| return self | |
| def __exit__(self, exception_type, exception_value, traceback): | |
| return exception_value is not None | |
| def log_usage(*log_args, **log_kwargs): | |
| def _log_usage(func): | |
| def wrapper(*args, **kwargs): | |
| return func(*args, **kwargs) | |
| return wrapper | |
| return _log_usage | |
| def set_environment(env): | |
| pass | |
| def patch_methods(tester, patch_log=True): | |
| pass | |