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

Spider tn #157

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Spider tn #157

wants to merge 7 commits into from

Conversation

kinianlo
Copy link
Contributor

An attempt to fix #156

@dimkart
Copy link
Contributor

dimkart commented Sep 30, 2024

@kinianlo Hi and thanks for the PR. In general, I think it's better to avoid any hidden manipulation at the tensor network level, since physical changes of this form can alter dramatically training. Perhaps a better solution here would be a spider-specific tensor ansatz which arranges the spiders reader output e.g. as follows, producing a chain of 3-legged spiders.

w1    w2
  \  /
   o      w3 
     \   /
       o    ....
        \   /
          o
          |
  • Have a look at MPSAnsatz, SpiderAnsatz, which break large tensors similarly in generic string diagrams.
  • Note this can be also implemented as a separate reader instead of a new ansatz, e.g. SpiderChainReader (perhaps this is even better).

@@ -46,3 +48,4 @@ def sentence2diagram(self,

spiders_reader = SpidersReader()
bag_of_words_reader = spiders_reader
spider_chain_reader = LinearReader(Spider(AtomicType.SENTENCE, 2, 1))
Copy link
Contributor Author

@kinianlo kinianlo Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinearReader requires a Diagram type but Spider is a Box. Should LinearReader be modified to also accept Box or we should convert the Spider into a diagram, e.g. using .to_diagram()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use .to_diagram() for now. Please also note that your branch requires some cleaning.

@neiljdo neiljdo requested a review from dimkart October 23, 2024 15:10
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

Successfully merging this pull request may close these issues.

spiders_reader on long sentences crashes
2 participants