Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
f5658732
Unverified
Commit
f5658732
authored
Apr 08, 2024
by
JINO ROHIT
Committed by
GitHub
Apr 08, 2024
Browse files
fixing issue 30034 - adding data format for run_ner.py (#30088)
parent
d16f0abc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
examples/pytorch/token-classification/README.md
examples/pytorch/token-classification/README.md
+14
-0
No files found.
examples/pytorch/token-classification/README.md
View file @
f5658732
...
...
@@ -25,6 +25,20 @@ customize it to your needs if you need extra processing on your datasets.
It will either run on a datasets hosted on our
[
hub
](
https://huggingface.co/datasets
)
or with your own text files for
training and validation, you might just need to add some tweaks in the data preprocessing.
### Using your own data
If you use your own data, the script expects the following format of the data -
```
bash
{
"chunk_tags"
:
[
11, 12, 12, 21, 13, 11, 11, 21, 13, 11, 12, 13, 11, 21, 22, 11, 12, 17, 11, 21, 17, 11, 12, 12, 21, 22, 22, 13, 11, 0],
"id"
:
"0"
,
"ner_tags"
:
[
0, 3, 4, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"pos_tags"
:
[
12, 22, 22, 38, 15, 22, 28, 38, 15, 16, 21, 35, 24, 35, 37, 16, 21, 15, 24, 41, 15, 16, 21, 21, 20, 37, 40, 35, 21, 7],
"tokens"
:
[
"The"
,
"European"
,
"Commission"
,
"said"
,
"on"
,
"Thursday"
,
"it"
,
"disagreed"
,
"with"
,
"German"
,
"advice"
,
"to"
,
"consumers"
,
"to"
,
"shun"
,
"British"
,
"lamb"
,
"until"
,
"scientists"
,
"determine"
,
"whether"
,
"mad"
,
"cow"
,
"disease"
,
"can"
,
"be"
,
"transmitted"
,
"to"
,
"sheep"
,
"."
]
}
```
The following example fine-tunes BERT on CoNLL-2003:
```
bash
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment