评估文档

Hub 方法

Hugging Face's logo
加入 Hugging Face 社区

并获取增强的文档体验

开始使用

Hub 方法

使用 Hugging Face Hub 的方法

推送到 Hub

evaluate.push_to_hub

< >

( model_id: str task_type: str dataset_type: str dataset_name: str metric_type: str metric_name: str metric_value: float task_name: str = None dataset_config: str = None dataset_split: str = None dataset_revision: str = None dataset_args: typing.Dict[str, int] = None metric_config: str = None metric_args: typing.Dict[str, int] = None overwrite: bool = False )

参数

  • model_id (str) — 来自 https://hf.co/models 的模型 ID。
  • task_type (str) — 任务 ID,请参考 https://github.com/huggingface/evaluate/blob/main/src/evaluate/config.py#L154 获取允许的值。
  • dataset_type (str) — 来自 https://hf.co/datasets 的数据集 ID。
  • dataset_name (str) — 数据集的别名。
  • metric_type (str) — 来自 https://hf.co/metrics 的指标 ID。
  • metric_name (str) — 指标的别名。
  • metric_value (float) — 计算出的指标值。
  • task_name (str, optional) — 任务的别名。
  • dataset_config (str, optional) — datasets.load_dataset() 中使用的数据集配置。 更多信息请参阅 huggingface/datasets 文档: https://huggingface.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset.name
  • dataset_split (str, optional) — 用于指标计算的 split 名称。
  • dataset_revision (str, optional) — 数据集特定版本的 Git 哈希值。
  • dataset_args (dict[str, int], optional) — 传递给 datasets.load_dataset() 的额外参数。
  • metric_config (str, optional) — 指标的配置(例如,GLUE 指标针对每个子集都有配置)
  • metric_args (dict[str, int], optional) — 在 Metric.compute() 期间传递的参数。
  • overwrite (bool, optional, defaults to False) — 如果设置为 True,则可以覆盖现有的指标字段,否则尝试覆盖任何现有字段将导致错误。

将指标结果推送到 Hub 中模型仓库的元数据。

示例

>>> push_to_hub(
...     model_id="huggingface/gpt2-wikitext2",
...     metric_value=0.5
...     metric_type="bleu",
...     metric_name="BLEU",
...     dataset_name="WikiText",
...     dataset_type="wikitext",
...     dataset_split="test",
...     task_type="text-generation",
...     task_name="Text Generation"
... )