Comments (8)
I was able to save the models to disk once I realized the graph adjacency and the features were also being written, as they are defined via tf.Constant
. This was pushing the size of the graph over the limit. To avoid saving these constants, I used tf.placeholder
in their place instead.
The change for supervised models can be seen in this commit in my fork. Happy to put in a pull request if you think there are no obvious downsides.
from graphsage.
Hi, sorry for the late reply since we are at conference.
What you said is indeed the case. Using placeholder for adj will solve the problem. However, we were concerned that there would be significant overhead when feeding in the same np array at each iteration.
In fact when I was using GraphSAGE for extremely large datasets (10^9 scale), I set the adj as a variable, and feed it in only at the start of training/validation/test.
But of course ideally we would want tensorflow to avoid the overhead when feeding the same array without modifications, so that placeholder would be the most elegant solution.
Rex
from graphsage.
@RexYing what is the final word on this? I suppose our current implementation in master branch is the simplest, but has the issue that the adjacency matrix is treated as part of the graph. I don't think having the adjacency as a placeholder is best because of the data I/O overhead, but maybe we should have a helper function or something that makes it easier to save the model?
from graphsage.
Shouldn't it be enough to assign the adjacency matrix placeholder once, before starting the training loop? Further I/O could be avoided also for validation/test sets if another instance of the learned model is created, and only the learned weights are copied to this instance when validation/testing is to be performed. Copying the weights should be orders of magnitude cheaper than swapping the adjacency matrix.
EDIT: I guess a clarification is in order. As far as I can tell from observed behaviour, I think if you do
adjacency_ph = tf.placeholder(tf.int32, shape=(size,), name='adjacency_ph')
adjacency = tf.Variable(adjacency_ph, trainable=False, name='adjacency')
and then outside the training loop run the assignment, e.g.: sess.run(tf.global_variables_initializer(), feed_dict={adjacency_ph: adj})
you are 1) only assigning to adjacency once, not on every iteration of the training loop and 2) still preventing the value of adjacency being written to the GraphDef by using the placeholder.
from graphsage.
@RexYing do you have thoughts on @laurimi's solution above? You have more experience dealing with this I/O overhead issue, but her solution seems to check out and it would be nice to not have the adjacency as part of the GraphDef.
(Btw, I am traveling and won't be able to test and push anything to master for at least a few days if this solution should be merged in).
from graphsage.
@laurimi I tested and it does work. Thanks for pointing it out. Would be happy to take the pull request.
Or I could do it myself if you are busy.
Thanks
Rex
from graphsage.
@RexYing Pull request sent. I decided to only apply the placeholder it for the adjacency matrix. It should be possible to do the same for the features as well, but I did not want to mess around with the model files since I don't feel so confident for now making modifications there.
from graphsage.
Thank very much for the contribution!
from graphsage.
Related Issues (20)
- Fatal Python error: Segmentation fault
- Is there any example notebooks of using this code?
- What's the difference between GraphSAGE-GCN and GraphSAGE-mean ?
- Norm of node representation z
- how sage train the node that only have 1 top neighbors? HOT 3
- 异构图生成二部图问题Graph is multigraph, cannot be converted to networkx graph. HOT 1
- What if the number of neighbors is less than the pre-defined number? HOT 1
- GraphSAGE for weighted graphs
- PPI ID-protein name correspondence?
- Unseen Node classification HOT 3
- Question about PPI: how to process C1, C3 and C7 into 50-dim features?
- WHY 2 layer loop in aggregate function?
- I'm new to graphsage. Can't run. Getting error.Please explain HOT 1
- Dense layers use relu with xavier initialization
- the code problem in utils HOT 1
- networkx issue with reddit dataset HOT 2
- what is the class in "<train_prefix>-class_map.json" means. HOT 1
- why i still can't run the program because an error No such file or directory: './example_data/ppi-G.json' HOT 1
- how to change the dataset HOT 1
- BLAS and GEMM occur error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphsage.