sassoftware / python-dlpy

The SAS Deep Learning Python (DLPy) package provides the high-level Python APIs to deep learning methods in SAS Visual Data Mining and Machine Learning. It allows users to build deep learning models using friendly Keras-like APIs.
Apache License 2.0
224 stars 131 forks source link

BERT model names #401

Closed anttiheino closed 10 months ago

anttiheino commented 10 months ago

Using Viya Stable 2023.09, dlpy 1.2.0

Only bert-, roberta-, and distil-models are supported, but there are Bert models like: iguanodon-ai/bert-base-finnish-uncased-ner. This causes issues with BERT_Model. Could the naming requirement be more flexible?

Code:

instantiate a version of the HuggingFace BERT model

huggingface_name = 'iguanodon-ai/bert-base-finnish-uncased-ner'

bert = BERT_Model(conn, cache_dir_fi, huggingface_name, n_classes, num_hidden_layers = num_encoder_layers, max_seq_len=256, verbose=True)

Error:

DLPyError Traceback (most recent call last) Input In [24], in <cell line: 4>() 1 # instantiate a version of the HuggingFace BERT model 2 huggingface_name = 'iguanodon-ai/bert-base-finnish-uncased-ner' ----> 4 bert = BERT_Model(conn, 5 cache_dir_fi, 6 huggingface_name, 7 n_classes, 8 num_hidden_layers = num_encoder_layers, 9 max_seq_len=256, 10 verbose=True)

File /opt/conda/lib/python3.9/site-packages/dlpy/transformers/bert_model.py:128, in BERT_Model.init(self, conn, cache_dir, name, n_classes, num_hidden_layers, max_seq_len, seed, save_embedding, verbose) 126 hf_base_name = self._base_name.split('-')[0] 127 if hf_base_name not in ['bert', 'roberta', 'distilbert', 'distilroberta']: --> 128 raise DLPyError('You specified an unsupported model variant.' 129 'Only bert-, roberta-, and distil-' 130 'models are supported.') 132 if self._verbose: 133 print("NOTE: loading base model " + self._base_name + " ...")

DLPyError: You specified an unsupported model variant.Only bert-, roberta-, and distil-models are supported.

dxq77dxq commented 10 months ago

This issue was fixed by https://github.com/sassoftware/python-dlpy/pull/370/commits/48288d242f45d7d0210d11f689d34afd86f7d9d9. Please use the latest version of DLPy (1.2.1-dev).

anttiheino commented 10 months ago

Releases list 1.2.0 as the latest version. Where 1.2.1-dev is available?

dxq77dxq commented 10 months ago

pip install git+https://github.com/sassoftware/python-dlpy.git