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

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

Closed
17dacheng opened this issue Nov 10, 2022 · 6 comments
Closed

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

17dacheng opened this issue Nov 10, 2022 · 6 comments

Comments

@17dacheng
Copy link

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

@sokrypton
Copy link
Owner

sokrypton commented Nov 10, 2022 via email

@17dacheng
Copy link
Author

17dacheng commented Nov 11, 2022

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

Thanks!
Closing, as memory is a separate issue.

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

2 participants