Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to decode the embeds to original sequences #12

Open
samw0806 opened this issue May 29, 2024 · 0 comments
Open

how to decode the embeds to original sequences #12

samw0806 opened this issue May 29, 2024 · 0 comments

Comments

@samw0806
Copy link

samw0806 commented May 29, 2024

`import model_utils # found under the "tcr" folder

tcrbert_trb_cls = model_utils.load_classification_pipeline("wukevin/tcr-bert", device=0)

df = model_utils.reformat_classification_pipeline_preds(tcrbert_trb_cls([
"C A S S P V T G G I Y G Y T F", # Binds to NLVPMVATV CMV antigen
"C A T S G R A G V E Q F F", # Binds to GILGFVFTL flu antigen
]))
Is there any decoder that can decode the dataframe's output? Maybe like
'model = BertModel.from_pretrained("wukevin/tcr-bert").to(device)
tokenizer = BertTokenizer.from_pretrained("wukevin/tcr-bert")
outputs = model.decoder(embedding_tensor)
logits = outputs.logits
predicted_ids = torch.argmax(logits, dim=-1)

decoded_seq = tokenizer.decode(predicted_ids[0], skip_special_tokens=True)
decoded_sequences.append(decoded_seq)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant