Find answers from the community

Updated 3 months ago

Hey I have a problem of saving

Hey. I have a problem of saving composable graph into disk and load it. I wonder if anyone has the solution for this
L
R
21 comments
It's a tad janky.

All sub-indexes should share the same storage context object.

Then you can just call persist on the root

https://gpt-index.readthedocs.io/en/latest/core_modules/data_modules/index/composability.html#optional-persisting-the-graph
Attachment
Screen_Shot_2023-07-24_at_21.54.50.png
Thank you for helping me out. The problem is that I have been doing the same, but still got the problem
Are you able to share the code for this?
I can share a partial of it
We have a unit-test in the code for saving-loading a graph, it may also be helpful
https://github.com/jerryjliu/llama_index/blob/main/tests/indices/test_loading_graph.py
Attachments
Screen_Shot_2023-07-24_at_22.01.44.png
Screen_Shot_2023-07-24_at_22.02.13.png
Thank you. I appreciate that!
rather than setting the ID attribute directly, maybe try using the setter instead.

graph.root_index.set_index_id("my_id")

Also, just double checking that all subindexes are sharing the same storage context? 🀞

I realize this is pretty janky. It's actually a task for this week to make this a little smoother πŸ™‚
Yes, they all share the same storage_context
Haha. thank you for your effort in developing this for a better
I wonder if there is a remote storage for this, so that i don't need to rely on file system
Oops I still got the same issue even though i already use this graph.root_index.set_index_id
Attachment
Screen_Shot_2023-07-24_at_22.16.08.png
here is the index.json in the storage
I'm very confused why this isn't working πŸ€”
Writing a full example to confirm it works haha
would it be alright if i could dm you and share the code ? it maybe the case that my logic has the problem
yea go for it πŸ‘
oh I see. thank you.
Add a reply
Sign up and join the conversation on Discord