Update README.md
Browse files
README.md
CHANGED
@@ -35,7 +35,7 @@ from transformers import T5Tokenizer, T5ForConditionalGeneration
|
|
35 |
tokenizer = T5Tokenizer.from_pretrained('dkarthikeyan1/tcrt5_ft_tcrdb')
|
36 |
tcrt5 = T5ForConditionalGeneration.from_pretrained("dkarthikeyan1/tcrt5_ft_tcrdb")
|
37 |
pmhc = "[PMHC]KLGGALQAK[SEP]YFAMYQENVAQTDVDTLYIIYRDYTWAELAYTWY[EOS]"
|
38 |
-
encoded_pmhc = tokenizer(
|
39 |
|
40 |
# Define the number of TCRs you would like to generate ()
|
41 |
num_tcrs = 10
|
@@ -45,7 +45,7 @@ num_beams = 30
|
|
45 |
outputs = tcrt5.generate(**encoded_pmhc, max_new_tokens=25, num_return_sequences=num_tcrs, num_beams=num_beams)
|
46 |
|
47 |
# Use regex to get out the [TCR] tag
|
48 |
-
cdr3b_sequences = [re.sub(r'\[.*\]', '', x) for x in tokenizer.batch_decode(
|
49 |
|
50 |
>>> cdr3b_sequences
|
51 |
|
|
|
35 |
tokenizer = T5Tokenizer.from_pretrained('dkarthikeyan1/tcrt5_ft_tcrdb')
|
36 |
tcrt5 = T5ForConditionalGeneration.from_pretrained("dkarthikeyan1/tcrt5_ft_tcrdb")
|
37 |
pmhc = "[PMHC]KLGGALQAK[SEP]YFAMYQENVAQTDVDTLYIIYRDYTWAELAYTWY[EOS]"
|
38 |
+
encoded_pmhc = tokenizer(pmhc, return_tensors='pt')
|
39 |
|
40 |
# Define the number of TCRs you would like to generate ()
|
41 |
num_tcrs = 10
|
|
|
45 |
outputs = tcrt5.generate(**encoded_pmhc, max_new_tokens=25, num_return_sequences=num_tcrs, num_beams=num_beams)
|
46 |
|
47 |
# Use regex to get out the [TCR] tag
|
48 |
+
cdr3b_sequences = [re.sub(r'\[.*\]', '', x) for x in tokenizer.batch_decode(outputs, skip_special_tokens=True)]
|
49 |
|
50 |
>>> cdr3b_sequences
|
51 |
|