Instructions to use ctheodoris/Geneformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ctheodoris/Geneformer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="ctheodoris/Geneformer")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ctheodoris/Geneformer") model = AutoModelForMaskedLM.from_pretrained("ctheodoris/Geneformer") - Inference
- Notebooks
- Google Colab
- Kaggle
fix TypeError: TrainingArguments.__init__() got an unexpected keyword argument 'evaluation_strategy'
Due to the update of transformer, evaluation_strategy is now eval_strategy in the new version. The author ctheodoris has made corresponding modifications to this file [in: https://huggingface.co/ctheodoris/Geneformer/discussions/531#6822ed18c442885b1dcbf70a ], but the modification still has problems. The reasons are as follows: the original def_training_args dictionary is referenced from the classifier_utils.py file, which has already preset evaluation_strategy as the key, so the original modification in classifier.py here is incorrect:
if eval_data is None:
if transformers_version >= parse("4.46"):
def_training_args["eval_strategy"] = "no"
else:
def_training_args["evaluation_strategy"] = "no"
def_training_args["load_best_model_at_end"] = False
will still retain the evaluation_strategy field. The new modification can solve this problem through def_training_args["eval_strategy"] = def_training_args.pop("evaluation_strategy"):
if eval_data is None:
def_training_args["evaluation_strategy"] = "no"
def_training_args["load_best_model_at_end"] = False
if transformers_version >= parse("4.46"):
def_training_args["eval_strategy"] = def_training_args.pop("evaluation_strategy")
Thank you for the fix!