AutoProcessor AttributeError: 'NoneType' object has no attribute 'from_pretrained'

Hello, everyone!
I’m trying to deploy this model artificial-feelings/bark-forked · Hugging Face, which is forked from suno/bark. And in order to do that I added custom Init method code is below.

from transformers import AutoProcessor, AutoModel

class EndpointHandler():
    def __init__(self, path=""):
        self.processor = AutoProcessor.from_pretrained(path)
        self.model = AutoModel.from_pretrained(path)

When creating the endpoint I am getting this error

> self.processor = AutoProcessor.from_pretrained(path)
> 2023/07/21 11:15:57 ~ custom_pipeline = check_and_register_custom_pipeline_from_directory(model_dir)
> 2023/07/21 11:15:57 ~ Application startup failed. Exiting.
> 2023/07/21 11:15:57 ~ AttributeError: 'NoneType' object has no attribute 'from_pretrained'
> 2023/07/21 11:15:57 ~ File "/repository/", line 6, in __init__

Seems like AutoProcessor is not initialized. Could you please help. What am I doing wrong?
Thank you in advance.

you need to implement a __call__ method as well see: Create custom Inference Handler