-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix bug in render_network #2
base: master
Are you sure you want to change the base?
Conversation
L121 makes it so that `index` is never 0
ahh good catch with the |
arg=','.join(["f%d_%d"%(layer_indx-1,j) for j in range(lp.in_features)]) | ||
else: | ||
arg=','.join(["l%d_%d"%(layer_indx-1,j) for j in range(lp.in_features)]) | ||
|
||
weights = ','.join(map(str,lp.weight[i].data.tolist())) | ||
bias =','.join(map(str,lp.bias[i].data.tolist())) | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing you have 1 feature in the input so this was causing an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I encountered this on the 2-alanine example, so there's 4 (2 sin and 2 cos).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, weird, i will investigate this further then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code gives the correct behavior without in both instances if lp is a list but it is possible that pytorch has changed how it returns the bias when tolist() is called.
In [12]: lp=[1]
In [13]: ','.join(map(str,lp))
Out[13]: '1'
In [14]: lp=[1,2,3,4]
In [15]: ','.join(map(str,lp))
Out[15]: '1,2,3,4'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically, we only need a str that can be streamed to text file for plumed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the problem I was running in to was that tolist
was returning a scalar, i.e .','.join(map(str, 1))
, which results in a TypeError
since 1
is not iterable
if you are done with the PR, i can merge the changes. Thanks for bringing these in, I really appreciate it. |
Sure go ahead and merge, I'll send more as I work. FYI I'm using the vde package under msmbuilder |
vde_metadynamics/render_network.py
Outdated
try: | ||
bias =','.join(map(str,lp.bias[i].data.tolist())) | ||
except TypeError: | ||
bias = str(lb.bias[i].data.tolist()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be lp.bias[i]
not lb.bias[i]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, fixed!
L121 makes it so that
index
is never 0This change is