---
title: tapas-tiny-masklm
canonical_url: "https://www.modelscope.cn/models/google/tapas-tiny-masklm"
md_url: "https://www.modelscope.cn/models/google/tapas-tiny-masklm.md"
repository: google/tapas-tiny-masklm
last_updated: 2025-04-21
pipeline_tag: fill-mask
tasks:
  - fill-mask
model_type:
  - tapas
architectures:
  - TapasForMaskedLM
library_name:
  - tensorflow
  - pytorch
frameworks:
  - pytorch
downloads: 413
stars: 0
---

# tapas-tiny-masklm

> tapas-tiny-masklm - google 在 ModelScope 开源的模型。This model corresponds to tapasmasklmtinyreset of the original repository.

- **Repository**: google/tapas-tiny-masklm
- **Tasks**: fill-mask
- **Downloads**: 413
- **Stars**: 0
- **Last updated**: 2025-04-21

Source: https://www.modelscope.cn/models/google/tapas-tiny-masklm

---

This model corresponds to **tapas_masklm_tiny_reset** of the [original repository](https://github.com/google-research/tapas).

Here's how you can use it:

```python
from transformers import TapasTokenizer, TapasForMaskedLM
import pandas as pd
import torch

tokenizer = TapasTokenizer.from_pretrained("google/tapas-tiny-masklm")
model = TapasForMaskedLM.from_pretrained("google/tapas-tiny-masklm")

data = {'Actors': ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
        'Age': ["56", "45", "59"],
        'Number of movies': ["87", "53", "69"]
}
table = pd.DataFrame.from_dict(data)
query = "How many movies has Leonardo [MASK] Caprio played in?"

# prepare inputs
inputs = tokenizer(table=table, queries=query, padding="max_length", return_tensors="pt")

# forward pass
outputs = model(**inputs)

# return top 5 values and predictions
masked_index = torch.nonzero(inputs.input_ids.squeeze() == tokenizer.mask_token_id, as_tuple=False)
logits = outputs.logits[0, masked_index.item(), :]
probs = logits.softmax(dim=0)
values, predictions = probs.topk(5)

for value, pred in zip(values, predictions):
  print(f"{tokenizer.decode([pred])} with confidence {value}")
```
