Fix: Correct prediction printing logic in example code
Browse files## Description
This PR fixes runtime errors in the example code of the model card.
The following line triggered an exception at runtime:
```python
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
```
## Changes
Replaced:
```python
[print("%7s" % int(prediction), end="") for prediction in predictions.tolist()]
```
with:
```python
[print("%7s" % int(pred), end="") for pred in predictions[0]]
```
## 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.
@@ -32,5 +32,5 @@ predictions = torch.round((torch.sign(discriminator_outputs[0]) + 1) / 2)
|
|
32 |
|
33 |
[print("%7s" % token, end="") for token in fake_tokens]
|
34 |
|
35 |
-
[print("%7s" % int(
|
36 |
```
|
|
|
32 |
|
33 |
[print("%7s" % token, end="") for token in fake_tokens]
|
34 |
|
35 |
+
[print("%7s" % int(pred), end="") for pred in predictions[0]]
|
36 |
```
|