Download register.py from unitxt/data: direct link, hf CLI and curl.
- Browser
- Download file 487 Bytes
-
https://huggingface.co/datasets/unitxt/data/resolve/c679ad357fb436cf8d68fbc2de6fa6f3ae577deb/register.py
- Command line
-
hf download hf://datasets/unitxt/data@c679ad357fb436cf8d68fbc2de6fa6f3ae577deb/register.py
-
curl -L -o register.py https://huggingface.co/datasets/unitxt/data/resolve/c679ad357fb436cf8d68fbc2de6fa6f3ae577deb/register.py
487 Bytes
| from .artifact import Artifact | |
| from . import blocks | |
| import inspect | |
| def register_blocks(): | |
| # Iterate over every object in the blocks module | |
| for name, obj in inspect.getmembers(blocks): | |
| # Make sure the object is a class | |
| if inspect.isclass(obj): | |
| # Make sure the class is a subclass of Artifact (but not Artifact itself) | |
| if issubclass(obj, Artifact) and obj is not Artifact: | |
| Artifact.register_class(obj) | |
| register_blocks() | |