|
|
|
|
|
|
|
|
""" |
|
|
Hugging Face Model Repository Init File |
|
|
|
|
|
This file should be renamed to __init__.py and placed at the root of your |
|
|
Hugging Face model repository. It ensures that the model registration code |
|
|
is executed when the model is loaded from the Hub. |
|
|
""" |
|
|
|
|
|
print("\n========================================\n") |
|
|
print(" root/__init__.py: Is this being run?") |
|
|
print("\n========================================\n") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
from models import * |
|
|
except ImportError as e: |
|
|
|
|
|
from transformers import AutoConfig, AutoModel, AutoModelForCausalLM |
|
|
from models.shared_space_config import SharedSpaceDecoderConfig |
|
|
from models.shared_space_decoder import ( |
|
|
SharedSpaceDecoderPreTrainedModel, |
|
|
SharedSpaceDecoderModel, |
|
|
) |
|
|
from layers.task_heads import SharedSpaceDecoderForCausalLM |
|
|
|
|
|
|
|
|
AutoConfig.register("shared_space_decoder", SharedSpaceDecoderConfig) |
|
|
|
|
|
|
|
|
AutoModel.register(SharedSpaceDecoderConfig, SharedSpaceDecoderModel) |
|
|
AutoModelForCausalLM.register(SharedSpaceDecoderConfig, SharedSpaceDecoderForCausalLM) |
|
|
|