wukevin / tcr-bert

Large language modeling applied to T-cell receptor (TCR) sequences.
Apache License 2.0
47 stars 8 forks source link

Using tcrbert offline #10

Open sakinaamin opened 8 months ago

sakinaamin commented 8 months ago

Hi Kevin, thanks for creating this model. I am trying to apply it for my dataset on a remote cluster, so I saved tcrbert_model offline as: tcrbert_model = BertModel.from_pretrained("wukevin/tcr-bert") #in internet tcrbert_model.save_pretrained("./tcrbert_model") #saved in working directory

tcrbert_model = BertModel.from_pretrained("path/to/working/directory/tcrbert_model") tcrbert_trb_cls = model_utils.load_classification_pipeline("path/to/working/directory/tcrbert_model", device=0)

Some weights of BertForSequenceClassification were not initialized from the model checkpoint at /path/to/working/directory/tcrbert_model and are newly initialized: ['classifier.bias', 'classifier.weight'] You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference. Traceback (most recent call last): File "", line 1, in File "path/to/working/directory/tcr-bert/tcr/model_utils.py", line 307, in load_classification_pipeline pipeline = TextClassificationPipeline( File "path/to/working/directory/tcrbert/lib/python3.9/site-packages/transformers/pipelines/text_classification.py", line 83, in init super().init(**kwargs) File "path/to/working/directory/tcrbert/lib/python3.9/site-packages/transformers/pipelines/base.py", line 861, in init raise ValueError(f"{device} unrecognized or not available.") ValueError: 0 unrecognized or not available.

Many thanks!

Best, Sakina