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
18db92dd
Unverified
Commit
18db92dd
authored
May 01, 2020
by
Sam Shleifer
Committed by
GitHub
May 01, 2020
Browse files
[testing] add timeout_decorator (#3543)
parent
b8686174
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
setup.cfg
setup.cfg
+1
-0
setup.py
setup.py
+1
-1
tests/test_modeling_bart.py
tests/test_modeling_bart.py
+3
-1
No files found.
setup.cfg
View file @
18db92dd
...
@@ -23,6 +23,7 @@ known_third_party =
...
@@ -23,6 +23,7 @@ known_third_party =
tensorboardX
tensorboardX
tensorflow
tensorflow
tensorflow_datasets
tensorflow_datasets
timeout_decorator
torch
torch
torchtext
torchtext
torchvision
torchvision
...
...
setup.py
View file @
18db92dd
...
@@ -72,7 +72,7 @@ extras["torch"] = ["torch==1.4.0"]
...
@@ -72,7 +72,7 @@ extras["torch"] = ["torch==1.4.0"]
extras
[
"serving"
]
=
[
"pydantic"
,
"uvicorn"
,
"fastapi"
,
"starlette"
]
extras
[
"serving"
]
=
[
"pydantic"
,
"uvicorn"
,
"fastapi"
,
"starlette"
]
extras
[
"all"
]
=
extras
[
"serving"
]
+
[
"tensorflow"
,
"torch"
]
extras
[
"all"
]
=
extras
[
"serving"
]
+
[
"tensorflow"
,
"torch"
]
extras
[
"testing"
]
=
[
"pytest"
,
"pytest-xdist"
]
extras
[
"testing"
]
=
[
"pytest"
,
"pytest-xdist"
,
"timeout-decorator"
]
extras
[
"docs"
]
=
[
"recommonmark"
,
"sphinx"
,
"sphinx-markdown-tables"
,
"sphinx-rtd-theme"
]
extras
[
"docs"
]
=
[
"recommonmark"
,
"sphinx"
,
"sphinx-markdown-tables"
,
"sphinx-rtd-theme"
]
extras
[
"quality"
]
=
[
extras
[
"quality"
]
=
[
"black"
,
"black"
,
...
...
tests/test_modeling_bart.py
View file @
18db92dd
...
@@ -13,10 +13,11 @@
...
@@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
tempfile
import
tempfile
import
unittest
import
unittest
import
timeout_decorator
# noqa
from
transformers
import
is_torch_available
from
transformers
import
is_torch_available
from
.test_configuration_common
import
ConfigTester
from
.test_configuration_common
import
ConfigTester
...
@@ -357,6 +358,7 @@ class BartHeadTests(unittest.TestCase):
...
@@ -357,6 +358,7 @@ class BartHeadTests(unittest.TestCase):
loss
=
outputs
[
0
]
loss
=
outputs
[
0
]
self
.
assertIsInstance
(
loss
.
item
(),
float
)
self
.
assertIsInstance
(
loss
.
item
(),
float
)
@
timeout_decorator
.
timeout
(
1
)
def
test_lm_forward
(
self
):
def
test_lm_forward
(
self
):
config
,
input_ids
,
batch_size
=
self
.
_get_config_and_data
()
config
,
input_ids
,
batch_size
=
self
.
_get_config_and_data
()
lm_labels
=
ids_tensor
([
batch_size
,
input_ids
.
shape
[
1
]],
self
.
vocab_size
).
to
(
torch_device
)
lm_labels
=
ids_tensor
([
batch_size
,
input_ids
.
shape
[
1
]],
self
.
vocab_size
).
to
(
torch_device
)
...
...
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