Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
804b43a
Delete checkpoints after integration test
Nayef211 Aug 29, 2022
7ae058d
Use pytest fixtures to autodelete model assets in integration tests
Nayef211 Aug 31, 2022
8694c20
Created new unittest directory and new workflow for integration tests
Nayef211 Aug 31, 2022
059040a
Fix imports
Nayef211 Aug 31, 2022
6ab701e
Readded ignored assets
Nayef211 Aug 31, 2022
6a5dd64
Remove changes from download_hooks
Nayef211 Aug 31, 2022
b769cbb
change to install instead of develop
Nayef211 Sep 1, 2022
caf5a3c
Merge branch 'main' into test/create_new_unittest_folder
Nayef211 Sep 1, 2022
4b4a2f9
Using setup.py develop on unittest and integration tests
Nayef211 Sep 1, 2022
c8db986
Debug integration test
Nayef211 Sep 6, 2022
60c9127
Debug integration test
Nayef211 Sep 7, 2022
1185352
Debug
Nayef211 Sep 7, 2022
a6a7688
debug
Nayef211 Sep 8, 2022
568352f
Debug
Nayef211 Sep 8, 2022
dfa6262
Debug
Nayef211 Sep 8, 2022
fb53ac7
Debug
Nayef211 Sep 8, 2022
3798e3f
debug
Nayef211 Sep 8, 2022
aeda55c
set cxx abi flag to 1
Nayef211 Sep 8, 2022
379a4e0
remove symbol prints
Nayef211 Sep 8, 2022
226dc0b
set cxx_abi flag
Nayef211 Sep 8, 2022
33a18f1
Remove debug step
Nayef211 Sep 8, 2022
d15045b
Add expecttest dep
Nayef211 Sep 8, 2022
6a420ca
Remove debug lines
Nayef211 Sep 8, 2022
2e952b6
Finalize integration test workflow
Nayef211 Sep 8, 2022
dd88a86
Merge branch 'main' into test/create_new_unittest_folder
Nayef211 Sep 8, 2022
3da03e6
Remove cd to root dir
Nayef211 Sep 8, 2022
dc894df
Add helper function to pass correct D_GLIBCXX_USE_CXX11_ABI value fro…
Nayef211 Sep 9, 2022
202f47d
Added cxx_abi flag to cmake_cxx_flags
Nayef211 Sep 9, 2022
7793268
Merge branch 'main' into test/create_new_unittest_folder
Nayef211 Sep 15, 2022
cbea81c
Resolving PR comments
Nayef211 Sep 15, 2022
51da495
Fix call to compiled_with_cxx11_abi fn
Nayef211 Sep 15, 2022
dedb0a9
Added new cache variable to store D_GLIBCXX_USE_CXX11_ABI flag value
Nayef211 Sep 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/unittest/linux/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env

python -m torch.utils.collect_env
pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 test
cd test
pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest
3 changes: 2 additions & 1 deletion .circleci/unittest/windows/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
conda activate ./env

python -m torch.utils.collect_env
pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 test
cd test
pytest --cov=torchtext --junitxml=test-results/junit.xml -v --durations 20 torchtext_unittest
31 changes: 31 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Integration Test

on:
pull_request:
branches: [main]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: |
python -m pip install --quiet --upgrade pip
python -m pip install --quiet --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
python -m pip install --quiet pytest requests cmake ninja sentencepiece parameterized tqdm expecttest
python setup.py install
- name: Run integration test
run: |
cd test && pytest integration_tests -v --use-tmp-hub-dir
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ option(BUILD_TORCHTEXT_PYTHON_EXTENSION "Build Python extension" OFF)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(TORCH_INSTALL_PREFIX "${CMAKE_PREFIX_PATH}/../.." CACHE STRING "Install path for torch")
set(TORCH_COMPILED_WITH_CXX_ABI "-D_GLIBCXX_USE_CXX11_ABI=0" CACHE STRING "Compile torchtext with cxx11_abi")

find_library(TORCH_C10_LIBRARY c10 PATHS "${TORCH_INSTALL_PREFIX}/lib")
find_library(TORCH_LIBRARY torch PATHS "${TORCH_INSTALL_PREFIX}/lib")
Expand All @@ -60,8 +61,7 @@ if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

# TORCH_CXX_FLAGS contains the same -D_GLIBCXX_USE_CXX11_ABI value as PyTorch
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${TORCH_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_COMPILED_WITH_CXX_ABI} -Wall ${TORCH_CXX_FLAGS}")

add_subdirectory(third_party)
add_subdirectory(torchtext/csrc)
Empty file removed test/.gitignore
Empty file.
4 changes: 2 additions & 2 deletions test/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def pytest_addoption(parser):
)


@pytest.fixture(scope="class")
@pytest.fixture(autouse=True, scope="class")
def temp_hub_dir(tmp_path_factory, pytestconfig):
if not pytestconfig.getoption("--use-tmp-hub-dir"):
if not pytestconfig.getoption("use_tmp_hub_dir"):
yield
else:
tmp_dir = tmp_path_factory.mktemp("hub", numbered=True).resolve()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import pytest # noqa: F401
import torch
from parameterized import parameterized, parameterized_class
from test.common.assets import get_asset_path
from test.common.parameterized_utils import nested_params
from test.common.torchtext_test_case import TorchtextTestCase
from torchtext.prototype.models import (
T5_BASE_ENCODER,
T5_BASE,
Expand All @@ -18,6 +15,9 @@
T5Transform,
)
from torchtext.prototype.models.t5.wrapper import T5Wrapper
from torchtext_unittest.common.assets import get_asset_path
from torchtext_unittest.common.parameterized_utils import nested_params
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase


BUNDLERS = {
Expand Down
10 changes: 8 additions & 2 deletions test/integration_tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
XLMR_BASE_ENCODER,
XLMR_LARGE_ENCODER,
)
from torchtext_unittest.common.assets import get_asset_path
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase

from ..common.assets import get_asset_path
from ..common.torchtext_test_case import TorchtextTestCase
BUNDLERS = {
"xlmr_base": XLMR_BASE_ENCODER,
"xlmr_large": XLMR_LARGE_ENCODER,
"roberta_base": ROBERTA_BASE_ENCODER,
"roberta_large": ROBERTA_LARGE_ENCODER,
}

BUNDLERS = {
"xlmr_base": XLMR_BASE_ENCODER,
Expand Down
Empty file removed test/prototype/models/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from unittest.mock import patch

import torch
from test.common.torchtext_test_case import TorchtextTestCase
from torch.nn import functional as F
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase


class TestModels(TorchtextTestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from test.common.assets import get_asset_path
from test.common.torchtext_test_case import TorchtextTestCase
from torchtext.prototype.models import T5Transform
from torchtext_unittest.common.assets import get_asset_path
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase


class TestTransforms(TorchtextTestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import tempfile

import torch
from test.common.assets import get_asset_path
from test.common.torchtext_test_case import TorchtextTestCase
from torchtext.prototype.transforms import (
sentencepiece_processor,
sentencepiece_tokenizer,
VectorTransform,
)
from torchtext.prototype.vectors import FastText
from torchtext_unittest.common.assets import get_asset_path
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase


class TestTransforms(TorchtextTestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import unittest

import torch
from test.common.torchtext_test_case import TorchtextTestCase
from torchtext.prototype.vectors import build_vectors
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase


class TestVectors(TorchtextTestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from functools import partial

import torch
from test.common.torchtext_test_case import TorchtextTestCase
from torch.utils.data import DataLoader
from torchtext.data.functional import custom_replace
from torchtext.prototype.transforms import (
Expand All @@ -19,6 +18,7 @@
from torchtext.prototype.vectors import build_vectors, FastText, GloVe, load_vectors_from_file_path
from torchtext.prototype.vocab_factory import build_vocab_from_text_file, load_vocab_from_file
from torchtext.utils import download_from_url
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase

from ..common.assets import get_asset_path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import unittest
from urllib.parse import urljoin

from test.common.assets import conditional_remove, get_asset_path
from torchtext import _TEXT_BUCKET
from torchtext import utils
from torchtext_unittest.common.assets import conditional_remove, get_asset_path

from .common.torchtext_test_case import TorchtextTestCase

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pytest
import torch
from test.common.torchtext_test_case import TorchtextTestCase
from torchtext.vocab import build_vocab_from_iterator, vocab
from torchtext_unittest.common.torchtext_test_case import TorchtextTestCase


class TestVocab(TorchtextTestCase):
Expand Down
5 changes: 5 additions & 0 deletions tools/setup_helpers/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
_ROOT_DIR = _THIS_DIR.parent.parent.resolve()


def _get_cxx11_abi():
return "-D_GLIBCXX_USE_CXX11_ABI=" + str(int(torch.compiled_with_cxx11_abi()))


def get_ext_modules():
modules = [
Extension(name=_LIBTORCHTEXT_NAME, sources=[]),
Expand Down Expand Up @@ -72,6 +76,7 @@ def build_extension(self, ext):
"-DBUILD_SHARED_LIBS=OFF",
"-DCMAKE_POLICY_DEFAULT_CMP0063=NEW",
"-DSPM_ENABLE_SHARED=OFF",
f"-DTORCH_COMPILED_WITH_CXX_ABI={_get_cxx11_abi()}",
]
build_args = ["--target", "install"]

Expand Down