Pipelines: miscellanea of QoL improvements and small features... (#4632)

* [hf_api] Attach all unknown attributes for future-proof compatibility

* [Pipeline] NerPipeline is really a TokenClassificationPipeline

* modelcard.py: I don't think we need to force the download

* Remove config, tokenizer from SUPPORTED_TASKS as we're moving to one model = one weight + one tokenizer

* FillMaskPipeline: also output token in string form

* TextClassificationPipeline: option to return all scores, not just the argmax

* Update docs/source/main_classes/pipelines.rst
This commit is contained in:
Julien Chaumond
2020-06-03 03:51:31 -04:00
committed by GitHub
parent 8ed47aa10b
commit 99207bd112
4 changed files with 52 additions and 56 deletions

View File

@@ -64,6 +64,8 @@ class S3Object:
self.lastModified = lastModified
self.size = size
self.rfilename = rfilename
for k, v in kwargs.items():
setattr(self, k, v)
class ModelInfo:
@@ -78,7 +80,7 @@ class ModelInfo:
author: Optional[str] = None,
downloads: Optional[int] = None,
tags: List[str] = [],
siblings: List[Dict] = [], # list of files that constitute the model
siblings: Optional[List[Dict]] = None, # list of files that constitute the model
**kwargs
):
self.modelId = modelId
@@ -86,7 +88,9 @@ class ModelInfo:
self.author = author
self.downloads = downloads
self.tags = tags
self.siblings = [S3Object(**x) for x in siblings]
self.siblings = [S3Object(**x) for x in siblings] if siblings is not None else None
for k, v in kwargs.items():
setattr(self, k, v)
class HfApi: