anon-repair-bot commited on
Commit
74364c8
·
verified ·
1 Parent(s): 94d69c9

Fix: Replace incompatible model loading in example code

Browse files

## Description

The example code fails at runtime with the following error when attempting to run the fill-mask task:
```python
KeyError: 'logits'
```

## Changes

Replaced:
```python
pipe = pipeline('fill-mask', model=model, tokenizer=tokenizer)
```
with:
```python
pipe = pipeline('fill-mask', model="neuralmind/bert-base-portuguese-cased")
```

## Testing
The code has been successfully tested and runs without error.

## Note
This contribution is part of an ongoing research initiative to systematically identify and correct faulty example code in Hugging Face Model Cards.
We would appreciate a timely review and integration of this patch to support code reliability and enhance reproducibility for downstream users.

Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -41,7 +41,7 @@ tokenizer = AutoTokenizer.from_pretrained('neuralmind/bert-base-portuguese-cased
41
  ```python
42
  from transformers import pipeline
43
 
44
- pipe = pipeline('fill-mask', model=model, tokenizer=tokenizer)
45
 
46
  pipe('Tinha uma [MASK] no meio do caminho.')
47
  # [{'score': 0.14287759363651276,
 
41
  ```python
42
  from transformers import pipeline
43
 
44
+ pipe = pipeline('fill-mask', model="neuralmind/bert-base-portuguese-cased")
45
 
46
  pipe('Tinha uma [MASK] no meio do caminho.')
47
  # [{'score': 0.14287759363651276,