elastic / eland

Python Client and Toolkit for DataFrames, Big Data, Machine Learning and ETL in Elasticsearch
https://eland.readthedocs.io
Apache License 2.0
628 stars 98 forks source link

Make access_token an optional parameter in TransformerModel #617

Closed mbarretta closed 9 months ago

mbarretta commented 9 months ago

608 changed the TransformerModel constructor, making the access_token attribute required. Since tokens are not required for public models, users must now set access_token to an empty string to use the model. I think this is an unnecessary breaking change.

joshdevins commented 9 months ago

Notebooks are calling the Python methods directly and not using the import script, so this change in #608 broke the method signature. We just need to make the arg default to None and move it in the arg list.

(26] load model ("dslim/bert-base-NER"
"ner")
Loading HuggingFace transformer tokenizer and model [slim/bert-base-NER] for task [ner]
TypeError
<ipython-input-26-ele3b282bf1> in <cell line: 1> ()
----> 1 load model ("dslim/bert-base-NER"
Traceback (most recent call last)
"ner")
<ipython-input-25-891c440b381e> in load model (model id, task type)
print (f"Loading HuggingFace transformer tokenizer and model [ {model id)l for task [{task type}]" )
tm
= TransformerModel (model id=model id, task type=task type)
model_path, config, vocab_path = tm.save (tmp_dir)
TypeError: TransformerModel. init () missing 1 required keyword-only argument: 'access token'