mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-09 19:34:53 +00:00
Make B a generic type of Model
This PR fixes typing error at `def batch_type`
This commit is contained in:
parent
5a58226130
commit
27d30f685a
@ -1,7 +1,7 @@
|
||||
import torch
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Tuple, Optional, TypeVar, Type
|
||||
from typing import Generic, List, Tuple, Optional, TypeVar, Type
|
||||
from transformers import PreTrainedTokenizerBase
|
||||
|
||||
from text_generation_server.models.types import Batch, GeneratedText
|
||||
@ -10,7 +10,7 @@ from text_generation_server.pb.generate_pb2 import InfoResponse
|
||||
B = TypeVar("B", bound=Batch)
|
||||
|
||||
|
||||
class Model(ABC):
|
||||
class Model(ABC, Generic[B]):
|
||||
def __init__(
|
||||
self,
|
||||
model: torch.nn.Module,
|
||||
|
Loading…
Reference in New Issue
Block a user