Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/en/model_doc/persimmon.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ tar -xvf 8b_base_model_release.tar
Thereafter, models can be loaded via:

```python
from transformers import PersimmonForCausalLM, PersimmonTokenizer
from transformers import AutoTokenizer, PersimmonForCausalLM


model = PersimmonForCausalLM.from_pretrained("/output/path", device_map="auto")
tokenizer = PersimmonTokenizer.from_pretrained("/output/path")
tokenizer = AutoTokenizer.from_pretrained("/output/path")
```

- Perismmon uses a `sentencepiece` based tokenizer, with a `Unigram` model. It supports bytefallback, which is only available in `tokenizers==0.14.0` for the fast tokenizer.
Expand Down
4 changes: 3 additions & 1 deletion docs/source/en/model_doc/tapas.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ index) and batch encode each table with its questions. This will make sure that
You can then fine-tune [`TapasForQuestionAnswering`] as follows (shown here for the weak supervision for aggregation case):

```python
from transformers import AdamW, TapasConfig, TapasForQuestionAnswering
from torch.optim import AdamW

from transformers import TapasConfig, TapasForQuestionAnswering


# this is the default WTQ configuration
Expand Down
4 changes: 2 additions & 2 deletions docs/source/en/model_doc/trocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ The example below uses [bitsandbytes](../quantization/bitsandbytes) to quantize

```python
# pip install bitsandbytes accelerate
from transformers import TrOCRProcessor, VisionEncoderDecoderModel, BitsandBytesConfig
from transformers import TrOCRProcessor, VisionEncoderDecoderModel, BitsAndBytesConfig
import requests
from PIL import Image

# Set up the quantization configuration
quantization_config = BitsandBytesConfig(load_in_8bit=True)
quantization_config = BitsAndBytesConfig(load_in_8bit=True)

# Use a large checkpoint for a more noticeable impact
processor = TrOCRProcessor.from_pretrained("microsoft/trocr-large-handwritten")
Expand Down
6 changes: 5 additions & 1 deletion docs/source/en/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,13 @@ Mixin tests use tiny configs with random weights to verify model behavior quickl
Place integration tests in a separate test class, mark them with `@slow`, and mix in `MemoryCleanupMixin`. Each test downloads real weights, runs inference, and checks outputs against expected values. The mixin frees the memory each test takes and runs the test methods under `torch.no_grad()` — see [Releasing memory between tests](#releasing-memory-between-tests) for what it does and how to opt out.

```py
import unittest

import torch
from transformers import AutoTokenizer
from transformers.testing_utils import MemoryCleanupMixin, require_torch, slow, torch_device
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_memory_cleanup_mixin import MemoryCleanupMixin

class MyModelIntegrationTest(MemoryCleanupMixin, unittest.TestCase):
@slow
Expand Down
Loading