Spaces:
Running
Running
| """Model classes - one file per model. | |
| Traditional ML (sklearn-backed, TF-IDF input): | |
| - ``naive_bayes.NaiveBayesModel`` | |
| - ``svm_classifier.SVMModel`` (LinearSVC + CalibratedClassifierCV) | |
| - ``random_forest.RandomForestModel`` | |
| Hybrid DL (Keras, FastText input): | |
| - ``cnn_bigru.CNNBiGRUModel`` | |
| - ``cnn_lstm.CNNLSTMModel`` | |
| - ``cnn_svm.CNNSVMModel`` (Keras CNN feature extractor + LinearSVC head) | |
| Transformer fine-tuning (PyTorch + HuggingFace): | |
| - ``indobert.IndoBERTModel`` (`indobenchmark/indobert-base-p1`) | |
| - ``indobertweet.IBTModel`` (`indolem/indobertweet-base-uncased`) | |
| - ``xlm_roberta.XLMRobertaModel`` (`xlm-roberta-base`) | |
| - ``mdeberta.MDeBERTaModel`` (`microsoft/mdeberta-v3-base`) | |
| Hybrid Transformer - encoder + custom head, all use ``bert_heads`` modules: | |
| - ``indobert_hybrid``, ``mdeberta_hybrid``, ``xlm_roberta_hybrid`` | |
| (each exposes a model class for CNN / BiLSTM / CNN-BiLSTM head) | |
| - IBT-specific (separate due to active tuning scope): | |
| ``indobertweet_cnn.IBTCNNModel``, | |
| ``indobertweet_bilstm.IBTBiLSTMModel``, | |
| ``indobertweet_cnn_bilstm.IBTCNNBiLSTMModel`` | |
| Heads: | |
| - ``bert_heads.BertCNNHead`` - Conv1d β ReLU β Dropout β MaxPool β Linear | |
| - ``bert_heads.BertBiLSTMHead`` - BiLSTM(1 layer) β Dropout β MaxPool β Linear | |
| - ``bert_heads.BertCNNBiLSTMHead`` - Conv1d β ReLU β BiLSTM β Dropout β MaxPool β Linear | |
| DL/transformer classes are not re-exported here to avoid importing torch/keras | |
| at package-import time. Import them directly from their submodule. | |
| """ | |
| # Traditional-ML classes pull scikit-learn/joblib. Those are optional for the | |
| # slim demo image (which only needs the transformer path), so guard the | |
| # re-export: when the deps are installed this behaves exactly as before; when | |
| # they're absent (deploy env) the package still imports and the transformer | |
| # submodules remain usable via direct import. | |
| try: | |
| from .naive_bayes import NaiveBayesModel | |
| from .random_forest import RandomForestModel | |
| from .svm_classifier import SVMModel | |
| except ModuleNotFoundError: | |
| pass | |