docs: Fixed variables in f-strings (#20087)
* docs: Fixed variables in f-strings * Replace unknown `block` with known `block_type` in ValueError Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> * Add missing torch import in docs code block Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
This commit is contained in:
@@ -54,9 +54,9 @@ class ResnetConfig(PretrainedConfig):
|
||||
**kwargs,
|
||||
):
|
||||
if block_type not in ["basic", "bottleneck"]:
|
||||
raise ValueError(f"`block` must be 'basic' or bottleneck', got {block}.")
|
||||
raise ValueError(f"`block_type` must be 'basic' or bottleneck', got {block_type}.")
|
||||
if stem_type not in ["", "deep", "deep-tiered"]:
|
||||
raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {block}.")
|
||||
raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {stem_type}.")
|
||||
|
||||
self.block_type = block_type
|
||||
self.layers = layers
|
||||
@@ -145,6 +145,9 @@ class ResnetModel(PreTrainedModel):
|
||||
Para o modelo que irá classificar as imagens, vamos apenas alterar o método forward:
|
||||
|
||||
```py
|
||||
import torch
|
||||
|
||||
|
||||
class ResnetModelForImageClassification(PreTrainedModel):
|
||||
config_class = ResnetConfig
|
||||
|
||||
|
||||
Reference in New Issue
Block a user