Skip to content

Commit

Permalink
Fix id2label types (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewtun authored Oct 10, 2022
1 parent 9f65007 commit 448547b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions chapters/en/chapter7/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Since we are working on a token classification problem, we will use the `TFAutoM
They should be set by two dictionaries, `id2label` and `label2id`, which contain the mapping from ID to label and vice versa:

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down Expand Up @@ -653,7 +653,7 @@ Since we are working on a token classification problem, we will use the `AutoMod
They should be set by two dictionaries, `id2label` and `label2id`, which contain the mappings from ID to label and vice versa:

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down
4 changes: 2 additions & 2 deletions chapters/fr/chapter7/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Puisque nous travaillons sur un problème de classification de *tokens*, nous al
Elles devraient être définies par deux dictionnaires, `id2label` et `label2id`, qui contiennent la correspondance de l'identifiant à l'étiquette et vice versa :

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down Expand Up @@ -653,7 +653,7 @@ Puisque nous travaillons sur un problème de classification de *tokens*, nous al
Elles devraient être définies par deux dictionnaires, `id2label` et `label2id`, qui contiennent les correspondances entre identifiants et étiquettes et vice versa :

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down
4 changes: 2 additions & 2 deletions chapters/ja/chapter7/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ tf_eval_dataset = tokenized_datasets["validation"].to_tf_dataset(
id2label``label2id` という 2 つの辞書型データがあり、ID からラベル、ラベルから ID へのマッピングを設定することができます。

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down Expand Up @@ -675,7 +675,7 @@ metric.compute(predictions=[all_predictions], references=[all_labels])
id2label``label2id` という 2 つの辞書型データがあり、ID からラベル、ラベルから ID へのマッピングを設定することができます。

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down
4 changes: 2 additions & 2 deletions chapters/vi/chapter7/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ Vì chúng tôi đang giải quyết vấn đề phân loại token, chúng ta s
Chúng phải được đặt bởi hai từ điển, `id2label``label2id`, chứa ánh xạ từ ID đến nhãn và ngược lại:

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down Expand Up @@ -683,7 +683,7 @@ Vì chúng ta đang giải quyết vấn đề phân loại token, chúng ta s
Chúng phải được đặt bởi hai từ điển, `id2label``label2id`, chứa các ánh xạ từ ID đến nhãn và ngược lại:

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down
4 changes: 2 additions & 2 deletions chapters/zh-CN/chapter7/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ tf_eval_dataset = tokenized_datasets["validation"].to_tf_dataset(
它们应该由两个字典设置, `id2label``label2id` ,其中包含从 ID 到标签的映射,反之亦然:

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down Expand Up @@ -653,7 +653,7 @@ metric.compute(predictions=[all_predictions], references=[all_labels])
它们应该由两个字典设置, `id2label``label2id` ,其中包含从 ID 到标签的映射,反之亦然:

```py
id2label = {str(i): label for i, label in enumerate(label_names)}
id2label = {i: label for i, label in enumerate(label_names)}
label2id = {v: k for k, v in id2label.items()}
```

Expand Down

0 comments on commit 448547b

Please sign in to comment.