# relation is responding very slowly

**URL:** https://support.prodi.gy/t/relation-is-responding-very-slowly/4732
**Category:** Uncategorized
**Tags:** enhancement, relations
**Created:** [September 28, 2021, 6:57am UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732 "2021-09-28T06:57:24Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![BenfengXu](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@BenfengXu](https://support.prodi.gy/u/BenfengXu)
#### Post date: [September 28, 2021, 6:57am UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/1 "2021-09-28T06:57:24Z")

</div>

Hi,  
I have a major question on relation annotation being responded very slowly on my web; and a minor question on visulizing chinese tokenization (on relation annotation).

**Q1**  
The relation annotation front end is responding **very slow** on my operation, like moving, clicking, thus my annotation can not proceed. This happens when I have a rather long text (each document has thousands words). If I force split the document, the problem is greatly eased. However, this is not acceptable, because I have to annotate relations that across different sentences, and there is no valid position to split the text. (annother workaround is to split the document with overlapped sentences, but this will cause extra efforts, because I have to annotate the overlapped sentences twice).

Some info that might be helpful:

- My front end looks like this:  

- My launch command:

```python
python3 -m prodigy rel.manual re1 blank:zh dataset:demo1 --label=Relation.label --wrap

```

**Q2**  
I'm annotating on chinese text, so the text is not correctly tokenized and visulized as such. I tried load a spacy pipeline model (which is produced using spacy pipeline to\_disk, and can correctly tokenize my text), But this changes nothing, the visulization I see in the web is still the same, as shown above (only pre-labeled entity are tokenized correctly, others remain plain text).  
This is how I create my tokenize model:

```python
from spacy.lang.zh import Chinese
cfg = {"segmenter": "jieba"}
nlp = Chinese.from_config({"nlp": {"tokenizer": cfg}})
nlp.to_disk("jieba_tokenizer")

```

This is how I import it in my rel annotation service:

```python
python3 -m prodigy rel.manual re1 jieba_tokenizer dataset:demo1 --label=Relation.label --wrap

```

Is this the problem of rel.mannual, or am I doing wrong? Can you tip me the related document or example?

Thanks!

Benfeng

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [September 29, 2021, 9:52am UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/2 "2021-09-29T09:52:03Z")

</div>

Hi and sorry about this – it's currently expected that the interface becomes less performant for very long documents with many tokens, and we're working on a rewrite that doesn't have this problem. I think what makes it additionally tricky in your case is that you just end up with more tokens overall, due to the way the characters are segmented.

As a workaround, one thing you can do is use patterns to disable all tokens that you know won't ever be part of a relation – of course, only if that's possible. Obvious candidates are punctuation, but you might be able to write other disable patterns based on part-of-speech tags etc.

> [@BenfengXu](#):
>
> I'm annotating on chinese text, so the text is not correctly tokenized and visulized as such. I tried load a spacy pipeline model (which is produced using spacy pipeline to\_disk, and can correctly tokenize my text),

Can you double-check that when you load your custom pipeline with the tokenizer in Python and process a text, the tokens are segmented correctly? If a `Doc` produced by the model shows the correct tokens, Prodigy should refelct this accordingly in all recipes that use the model for tokenization.

---

<div class="post-metadata">

### Author: ![prohistamine](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@prohistamine](https://support.prodi.gy/u/prohistamine)
#### Post date: [October 18, 2021, 7:20pm UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/3 "2021-10-18T19:20:26Z")

</div>

Hi @ines, what is the timeline like for the rewrite that you mentioned?

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [October 20, 2021, 8:02am UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/4 "2021-10-20T08:02:18Z")

</div>

I can't give you a specific ETA at this point yet, sorry! But it's definitely something we have on our list of enhancements.

---

<div class="post-metadata">

### Author: ![apohllo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/apohllo/32/2757_2.png) [@apohllo](https://support.prodi.gy/u/apohllo)
#### Post date: [January 27, 2022, 8:30pm UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/5 "2022-01-27T20:30:37Z")

</div>

I have the same issue with very slow (unusable) interface with long documents and `rel.manual`.  
Any updates?

---

<div class="post-metadata">

### Author: ![apohllo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/apohllo/32/2757_2.png) [@apohllo](https://support.prodi.gy/u/apohllo)
#### Post date: [February 6, 2022, 1:09pm UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/6 "2022-02-06T13:09:39Z")

</div>

The issue occurs with at least `hover` event on tokens. @ines is it maybe possible to edit some JS and disable some features that causing this or this is a core code?  
I am working on long range dependency problems. I have tested LabelStudio and its relation annotation is working fast, but the software has other drawbacks.

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [February 10, 2022, 10:37am UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/7 "2022-02-10T10:37:47Z")

</div>

> [@apohllo](#):
>
> The issue occurs with at least `hover` event on tokens. @ines is it maybe possible to edit some JS and disable some features that causing this or this is a core code?

It's unfortunately not as simple as that because it all ties into how the interface is implemented,so need to refactor the interface using a different technology, which is currently in progress. The easiest workaround at the moment if you want to work with long dependencies is to try and limit the possible connections as much as you can by disabling tokens, e.g. those that you know won't be relevant. So if you're annotating relations between named entities, you can disable all tokens that are not part of an entity.

---

<div class="post-metadata">

### Author: ![apohllo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/apohllo/32/2757_2.png) [@apohllo](https://support.prodi.gy/u/apohllo)
#### Post date: [March 5, 2022, 11:12am UTC](https://support.prodi.gy/t/relation-is-responding-very-slowly/4732/8 "2022-03-05T11:12:12Z")

</div>

I disabled all the tokens that are not part of an entity and the time to create one relation is about 8 seconds (in document with 6k tokens and 500 spans) ☹

Great to hear that refactor is in progress!
