# HTML Embedding processing

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%3E%5C
**Category:** Intermediate\
**Created:** [January 6, 2022, 10:08am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425 "2022-01-06T10:08:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![natank](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@natank](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnatank)%5C
**Post date:** [January 6, 2022, 10:08am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F1 "2022-01-06T10:08:46Z")

</div>

I am interested in creating embedding to HTML tags in a web. Does Bert have such model?  
Other works that can be relevant

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [January 6, 2022, 1:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F2 "2022-01-06T13:40:10Z")

</div>

Hi,

[MarkupLM](https://github.com/microsoft/unilm/tree/master/markuplm) is such a model. I’ll add it soon to HuggingFace Transformers.

---

<div class="post-metadata">

**Author:** ![natank](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@natank](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnatank)%5C
**Post date:** [January 7, 2022, 5:49pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F3 "2022-01-07T17:49:36Z")

</div>

Can I already use it?

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [January 8, 2022, 9:09am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F4 "2022-01-08T09:09:57Z")

</div>

Technically yes, as follows:

```auto
!pip install -q https://github.com/NielsRogge/transformers.git@modeling_markuplm

from transformers import MarkupLMTokenizer, MarkupLMModel

tokenizer = MarkupLMTokenizer.from_pretrained("microsoft/markuplm-base")
model = MarkupLMModel.from_pretrained("microsoft/markuplm-base")

with open("path_to_html_file") as f:
       html_string = f.read()

encoding = tokenizer(html_string, return_tensors="pt")

# forward pass
outputs = model(**encoding)

```

Note that there are still some bugs and rough edges, which will be fixed soon.

---

<div class="post-metadata">

**Author:** ![FuriouslyAsleep](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/furiouslyasleep/32/4502_2.png) [@FuriouslyAsleep](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FFuriouslyAsleep)%5C
**Post date:** [January 22, 2022, 9:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F5 "2022-01-22T21:52:18Z")

</div>

Hi. Thanks so much for working this. I ran the code above in colab and am hitting the following error on the encoding line:

`_init_() missing 2 required positional arguments: 'merges_file' and 'tags_dict'`

Do I need to clone the unilm markup repo too somehow?

---

<div class="post-metadata">

**Author:** ![FuriouslyAsleep](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/furiouslyasleep/32/4502_2.png) [@FuriouslyAsleep](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FFuriouslyAsleep)%5C
**Post date:** [January 23, 2022, 8:22pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F6 "2022-01-23T20:22:26Z")

</div>

I think what needed to be done is change:

```auto
encoding = MarkupLMTokenizer(html_string, return_tensors="pt")

```

to

```auto
encoding = tokenizer(html_string, return_tensors="pt")

```

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [January 24, 2022, 8:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F7 "2022-01-24T08:41:33Z")

</div>

Yes my mistake, thanks for fixing.

---

<div class="post-metadata">

**Author:** ![FuriouslyAsleep](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/furiouslyasleep/32/4502_2.png) [@FuriouslyAsleep](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FFuriouslyAsleep)%5C
**Post date:** [February 12, 2022, 6:20pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F8 "2022-02-12T18:20:50Z")

</div>

@nielsr thanks again for working the markuplm, it was a good small learning experience trying to use your branch to get the thing running for fine tuning on the WEBsrc dataset per the creators’ git instructions. Draft space for qa on html strings is here:

[https://huggingface.co/spaces/FuriouslyAsleep/markupQAdemo](https://huggingface.co/spaces/FuriouslyAsleep/markupQAdemo)

I know it’s not your job but any idea why the fine tuning was gobbling up 70+ gb of ram before I trimmed the training set down to just one small single domain subset? Colab just kept giving out on me.

---

<div class="post-metadata">

**Author:** ![FuriouslyAsleep](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/furiouslyasleep/32/4502_2.png) [@FuriouslyAsleep](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FFuriouslyAsleep)%5C
**Post date:** [February 13, 2022, 7:13pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhtml-embedding-processing%2F13425%2F9 "2022-02-13T19:13:47Z")

</div>

Fine tuning colab is at:

> **[Google Colaboratory](https://colab.research.google.com/drive/1dL6EuCxpxVrqsAtObbNpiwL6JZ7lJixD?usp=sharing)**
