sokrypton / ColabDesign

Making Protein Design accessible to all via Google Colab!
549 stars 127 forks source link

'mk_af_model' object has no attribute 'aux' #97

Closed 17dacheng closed 1 year ago

17dacheng commented 1 year ago

'mk_af_model' object has no attribute 'aux', there is no self.aux when aux is none

sokrypton commented 1 year ago

Can you post the code you are using?

On Thu, Nov 10, 2022, 7:55 AM cheng wang @.***> wrote:

'mk_af_model' object has no attribute 'aux', there is no self.aux when aux is none

— Reply to this email directly, view it on GitHub https://github.com/sokrypton/ColabDesign/issues/97, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA76LAQJA6RBICNL3BFA4ZDWHTWF5ANCNFSM6AAAAAAR4Q4HHM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

17dacheng commented 1 year ago

Below is the code, thank! reported above error when run the last line: af_model.save_pdb(save_path)

def rg_loss(inputs, outputs):
      positions = outputs["structure_module"]["final_atom_positions"]
      ca = positions[:,residue_constants.atom_order["CA"]]
      center = ca.mean(0)
      rg = jnp.sqrt(jnp.square(ca - center).sum(-1).mean() + 1e-8)
      rg_th = 2.38 * ca.shape[0] ** 0.365
      rg = jax.nn.elu(rg - rg_th)
      return {"rg":rg}

if __name__ == '__main__':
    pdb_files = ['NavPas_LqhIT2.pdb', 'NavPas_LqhaIT.pdb']   
    data_dir = '/ai/cheng/data/zhongke/cryo-EM-mod'

    for pdb_file in pdb_files:    
        pdb_path = os.path.join(data_dir, pdb_file)
        save_path = os.path.join(data_dir, pdb_file.replace('.pdb', '_repaired.pdb'))

        clear_mem()
        af_model = mk_afdesign_model(protocol="partial",
                             loss_callback=rg_loss, # add rg_loss
                             use_templates=False)   # set True to constrain positions using template input

        if pdb_file == 'NavPas_LqhaIT.pdb':
            af_model.prep_inputs(pdb_filename=pdb_path, chain="A", pos="295,297,300,302,304,320,321,", length=100)
            af_model.rewire(loops=[36])            
            af_model.save_pdb(save_path)
17dacheng commented 1 year ago

Can you post the code you are using? On Thu, Nov 10, 2022, 7:55 AM cheng wang @.> wrote: 'mk_af_model' object has no attribute 'aux', there is no self.aux when aux is none — Reply to this email directly, view it on GitHub <#97>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA76LAQJA6RBICNL3BFA4ZDWHTWF5ANCNFSM6AAAAAAR4Q4HHM . You are receiving this because you are subscribed to this thread.Message ID: @.>

please check the above code

sokrypton commented 1 year ago

Oh I see what the problem is. You don't run any of the design protocols. The rewire function only sets up the new residue index and constraints, but you still need to run the design protocol to get a sequence that satisfies those constraints.

17dacheng commented 1 year ago

Oh I see what the problem is. You don't run any of the design protocols. The rewire function only sets up the new residue index and constraints, but you still need to run the design protocol to get a sequence that satisfies those constraints.

yes, thanks! I added run the design protocol and it works. but i got a memory issue, the gpu memory had reached 160G unexpectedly. I open a new question regarding the issue. please kindly help to see where is wrong.

sokrypton commented 1 year ago

Thanks! Closing, as memory is a separate issue.