Run this model with HF Jobs

Run microsoft/layoutlm-base-uncased on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/microsoft/layoutlm-base-uncased. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/microsoft/layoutlm-base-uncased on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Some weights of LayoutLMForSequenceClassification were not initialized from the model checkpoint at microsoft/layoutlm-base-uncased and are newly initialized

#4
by alexneakameni - opened

Hello,

In the version 4.38.1 of transformers, I have this issue while loading the model :
Some weights of LayoutLMForSequenceClassification were not initialized from the model checkpoint at microsoft/layoutlm-base-uncased and are newly initialized: ['classifier.bias', 'classifier.weight', 'layoutlm.embeddings.word_embeddings.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

Model structure :

LayoutLMEmbeddings(
  (word_embeddings): Embedding(30522, 768, padding_idx=0)
  (position_embeddings): Embedding(512, 768)
  (x_position_embeddings): Embedding(1024, 768)
  (y_position_embeddings): Embedding(1024, 768)
  (h_position_embeddings): Embedding(1024, 768)
  (w_position_embeddings): Embedding(1024, 768)
  (token_type_embeddings): Embedding(2, 768)
  (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
  (dropout): Dropout(p=0.1, inplace=False)
)

Code to reduce issue :

from transformers import LayoutLMForSequenceClassification

model = LayoutLMForSequenceClassification.from_pretrained("microsoft/layoutlm-base-uncased")

It seems to be solved by avoiding safe tensors : model = LayoutLMForSequenceClassification.from_pretrained("microsoft/layoutlm-base-uncased", use_safetensors=False)

Sign up or log in to comment