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
d32585a3
Commit
d32585a3
authored
Apr 21, 2020
by
Julien Chaumond
Browse files
Fix Torch.hub + Integration test
parent
7d40901c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
15 deletions
+43
-15
.github/workflows/github-torch-hub.yml
.github/workflows/github-torch-hub.yml
+32
-0
hubconf.py
hubconf.py
+3
-3
src/transformers/modeling_albert.py
src/transformers/modeling_albert.py
+3
-4
src/transformers/modeling_electra.py
src/transformers/modeling_electra.py
+3
-4
src/transformers/tokenization_camembert.py
src/transformers/tokenization_camembert.py
+1
-2
src/transformers/tokenization_xlm_roberta.py
src/transformers/tokenization_xlm_roberta.py
+1
-2
No files found.
.github/workflows/github-torch-hub.yml
0 → 100644
View file @
d32585a3
name
:
Torch hub integration
on
:
push
:
branches
:
-
"
*"
jobs
:
torch_hub_integration
:
runs-on
:
ubuntu-latest
steps
:
# no checkout necessary here.
-
name
:
Extract branch name
run
:
echo "::set-env name=BRANCH::${GITHUB_REF#refs/heads/}"
-
name
:
Check branch name
run
:
echo $BRANCH
-
name
:
Set up Python
uses
:
actions/setup-python@v1
with
:
python-version
:
3.7
-
name
:
Install dependencies
run
:
|
pip install torch
pip install numpy tokenizers boto3 filelock requests tqdm regex sentencepiece sacremoses
-
name
:
Torch hub list
run
:
|
python -c "import torch; print(torch.hub.list('huggingface/transformers:$BRANCH'))"
-
name
:
Torch hub help
run
:
|
python -c "import torch; print(torch.hub.help('huggingface/transformers:$BRANCH', 'modelForSequenceClassification'))"
hubconf.py
View file @
d32585a3
from
transformers
import
(
from
src.
transformers
import
(
AutoConfig
,
AutoConfig
,
AutoModel
,
AutoModel
,
AutoModelForQuestionAnswering
,
AutoModelForQuestionAnswering
,
...
@@ -6,10 +6,10 @@ from transformers import (
...
@@ -6,10 +6,10 @@ from transformers import (
AutoModelWithLMHead
,
AutoModelWithLMHead
,
AutoTokenizer
,
AutoTokenizer
,
)
)
from
transformers.file_utils
import
add_start_docstrings
from
src.
transformers.file_utils
import
add_start_docstrings
dependencies
=
[
"torch"
,
"
tqdm"
,
"boto3"
,
"requests
"
,
"regex"
,
"sentencepiece"
,
"sacremoses"
]
dependencies
=
[
"torch"
,
"
numpy"
,
"tokenizers"
,
"boto3"
,
"filelock"
,
"requests"
,
"tqdm
"
,
"regex"
,
"sentencepiece"
,
"sacremoses"
]
@
add_start_docstrings
(
AutoConfig
.
__doc__
)
@
add_start_docstrings
(
AutoConfig
.
__doc__
)
...
...
src/transformers/modeling_albert.py
View file @
d32585a3
...
@@ -22,11 +22,10 @@ import torch
...
@@ -22,11 +22,10 @@ import torch
import
torch.nn
as
nn
import
torch.nn
as
nn
from
torch.nn
import
CrossEntropyLoss
,
MSELoss
from
torch.nn
import
CrossEntropyLoss
,
MSELoss
from
transformers.configuration_albert
import
AlbertConfig
from
.configuration_albert
import
AlbertConfig
from
transformers.modeling_bert
import
ACT2FN
,
BertEmbeddings
,
BertSelfAttention
,
prune_linear_layer
from
transformers.modeling_utils
import
PreTrainedModel
from
.file_utils
import
add_start_docstrings
,
add_start_docstrings_to_callable
from
.file_utils
import
add_start_docstrings
,
add_start_docstrings_to_callable
from
.modeling_bert
import
ACT2FN
,
BertEmbeddings
,
BertSelfAttention
,
prune_linear_layer
from
.modeling_utils
import
PreTrainedModel
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
src/transformers/modeling_electra.py
View file @
d32585a3
...
@@ -4,10 +4,9 @@ import os
...
@@ -4,10 +4,9 @@ import os
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
from
transformers
import
ElectraConfig
,
add_start_docstrings
from
.activations
import
get_activation
from
transformers.activations
import
get_activation
from
.configuration_electra
import
ElectraConfig
from
.file_utils
import
add_start_docstrings
,
add_start_docstrings_to_callable
from
.file_utils
import
add_start_docstrings_to_callable
from
.modeling_bert
import
BertEmbeddings
,
BertEncoder
,
BertLayerNorm
,
BertPreTrainedModel
from
.modeling_bert
import
BertEmbeddings
,
BertEncoder
,
BertLayerNorm
,
BertPreTrainedModel
...
...
src/transformers/tokenization_camembert.py
View file @
d32585a3
...
@@ -22,8 +22,7 @@ from typing import List, Optional
...
@@ -22,8 +22,7 @@ from typing import List, Optional
import
sentencepiece
as
spm
import
sentencepiece
as
spm
from
transformers.tokenization_utils
import
PreTrainedTokenizer
from
.tokenization_utils
import
PreTrainedTokenizer
from
.tokenization_xlnet
import
SPIECE_UNDERLINE
from
.tokenization_xlnet
import
SPIECE_UNDERLINE
...
...
src/transformers/tokenization_xlm_roberta.py
View file @
d32585a3
...
@@ -20,8 +20,7 @@ import os
...
@@ -20,8 +20,7 @@ import os
from
shutil
import
copyfile
from
shutil
import
copyfile
from
typing
import
List
,
Optional
from
typing
import
List
,
Optional
from
transformers.tokenization_utils
import
PreTrainedTokenizer
from
.tokenization_utils
import
PreTrainedTokenizer
from
.tokenization_xlnet
import
SPIECE_UNDERLINE
from
.tokenization_xlnet
import
SPIECE_UNDERLINE
...
...
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