Demo / src /models /taskers /tasker.py
nguyenminh4099's picture
Upload folder using huggingface_hub
9411c06 verified
from abc import ABC
from typing import Any
class Tasker(ABC):
"""The abstract class for taskers."""
def __init__(self, *args, **kwargs):
pass
def pre_do(self, func, *args, **kwargs):
"""
Pre do before actually do on sample.
func:
Wrapped func
args:
Positional arguments
kwargs:
Keyword arguments
return:
Done sample
"""
raise NotImplemented("The method is not implement")
def do(self, sample: Any, *args, **kwargs) -> Any:
"""
Actually do task on sample.
sample:
Sample need to process
args:
Positional arguments
kwargs:
Keyword arguments
return:
Done sample
"""
raise NotImplemented("The method is not implement")
def post_do(self, sample: Any, *args, **kwargs):
"""
Post do after do on sample.
sample:
Sample need to process
args:
Positional arguments
kwargs:
Keyword arguments
return:
Done sample
"""
raise NotImplemented("The method is not implement")