# How to increase the max\_seq\_model LayoutLMV3

**URL:** <https://discuss.huggingface.co/t/how-to-increase-the-max-seq-model-layoutlmv3/27534>\
**Category:** Models\
**Created:** [December 9, 2022, 11:03am UTC](https://discuss.huggingface.co/t/how-to-increase-the-max-seq-model-layoutlmv3/27534 "2022-12-09T11:03:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davelza95](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@Davelza95](https://discuss.huggingface.co/u/Davelza95)\
**Post date:** [December 9, 2022, 11:03am UTC](https://discuss.huggingface.co/t/how-to-increase-the-max-seq-model-layoutlmv3/27534/1 "2022-12-09T11:03:23Z")

</div>

Hi there,

the model I am using is LayoutLMV3 ( **LayoutLMv3ForTokenClassification** ).

I want that the model can take more than 512 tokens because when the text is very large it does not classify the rest of it.

I want to increase the seq\_max\_length, I have changed from LayoutLMv3Config → max\_position\_embeddings = 1024, the bboxes dataset that I am using has a 1024 + [196](https://discuss.huggingface.co/t/layoutlmv3-sequence-length-vs-token-sequnce-length-size-mismatch/26270) + 1 = 1221 size, but this hasn’t worked.

I got a CUDA error:

```nohighlight
.../python3.8/layoutlm_model-packages/torch/nn/functional.py in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)
   2197 # remove once script supports set_grad_enabled
   2198 _no_grad_embedding_renorm_(weight, input, max_norm, norm_type)
-> 2199 return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)

RuntimeError: CUDA error: device-side assert triggered

```

This should be a matrix sizes error.

Can someone explain me, how can I increase the max\_seq\_length please.
