lhallee commited on
Commit
f7814fd
·
verified ·
1 Parent(s): 2a2e832

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md CHANGED
@@ -166,8 +166,43 @@ Folded with Chai1:
166
 
167
  `Synthyra/DSM_ppi_full` was actually trained to fill masks from any part of SeqA and SeqB. That means you can fully hallucinate plausibly interacting protein pairs.
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
 
170
 
 
171
 
172
  ## Demos
173
  There are various demos with many more to come. For example, in `demo_dsm_ppi_full.py` (run by `python -m demos.demo_dsm_ppi_full`) we perform a test on DSM-ppi.
 
166
 
167
  `Synthyra/DSM_ppi_full` was actually trained to fill masks from any part of SeqA and SeqB. That means you can fully hallucinate plausibly interacting protein pairs.
168
 
169
+ ```python
170
+ seq_a_length = 128
171
+ seq_b_length = 128
172
+
173
+ seq_a_template = ''.join([mask_token] * seq_a_length)
174
+ seq_b_template = ''.join([mask_token] * seq_b_length)
175
+
176
+ combined_input_str = seq_a_template + '<eos>' + seq_b_template
177
+
178
+ input_tokens = tokenizer.encode(combined_input_str, add_special_tokens=True, return_tensors='pt').to(device)
179
+
180
+ output = model.mask_diffusion_generate(
181
+ tokenizer=tokenizer,
182
+ input_tokens=input_tokens,
183
+ step_divisor=10, # lower is slower but better
184
+ temperature=1.0, # sampling temperature
185
+ remasking="random", # strategy for remasking tokens not kept
186
+ preview=False, # set this to True to watch the mask tokens get rilled in real time
187
+ slow=False, # adds a small delay to the real time filling (because it is usually very fast and watching carefully is hard!)
188
+ return_trajectory=False # set this to True to return the trajectory of the generation (what you watch in the preview)
189
+ ) # Note: output will be a tuple if return_trajectory is True
190
+
191
+ seqa, seqb = model.decode_dual_input(output, seperator='<eos>')
192
+ # Parse out the generated interactor part based on EOS tokens.
193
+ # Example: generated_full_seq_str.split(model_binder.tokenizer.eos_token)[1]
194
+ print(f"SeqA: {seqa[0][4:]}") # remove cls token
195
+ print(f"SeqB: {seqb[0]}")
196
+ ```
197
+
198
+ ```console
199
+ SeqA: MVNLAKMRQRTEQNLREVSSFVKILFHTVLKFPMKINIGIHVHINMQAAQNAAADQNMQATNVIDLHNFKMGKDIGVDNKASATAHIYDEAHHTFLQLGAIKLLHAIPMIAGPVRCRLPIGFGHRFRG
200
+ SeqB: HYKNPMHSLLDSNVLHKDVVEVRLPIKIGMELDVMASAMREFLMPGTQQGDLRVIAEKRPVNKLHTYRRDLVKLLLAGAKLGTEAKSVELDLYRTELGGLVVYIININIATWDIIFAKVKICRGNDKP
201
+ ```
202
 
203
+ Folded with Chai1:
204
 
205
+ ![image](https://github.com/user-attachments/assets/1bdfed76-3c01-49f1-a92e-55ada89c2895)
206
 
207
  ## Demos
208
  There are various demos with many more to come. For example, in `demo_dsm_ppi_full.py` (run by `python -m demos.demo_dsm_ppi_full`) we perform a test on DSM-ppi.