Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successfully run in Windows10 ! #24

Open
WindVChen opened this issue Nov 29, 2021 · 1 comment
Open

Successfully run in Windows10 ! #24

WindVChen opened this issue Nov 29, 2021 · 1 comment

Comments

@WindVChen
Copy link

WindVChen commented Nov 29, 2021

``As TASN uses "att_grid_generator_cuda" in its code, we should first run "python setup.py build/install".

However, in Windows10, we may encounter something wrong. And here is my solution, hope to be helpful. (It indeed takes my much time.)

First, if you use VS in Chinese, you need to first change line 299 (around) in "cpp_extension.py" like this:

 try:
        if sys.platform.startswith('linux'):
            minimum_required_version = MINIMUM_GCC_VERSION
            versionstr = subprocess.check_output([compiler, '-dumpfullversion', '-dumpversion'])
            version = versionstr.decode().strip().split('.')
        else:
            # minimum_required_version = MINIMUM_MSVC_VERSION
            # compiler_info = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
            # match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode().strip())
            # version = (0, 0, 0) if match is None else match.groups()
            print("________________windows operation system ______________________")
            minimum_required_version = MINIMUM_MSVC_VERSION
            compiler_info = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
            print("________________compiler info:", compiler_info)
            # match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode().strip())
            match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode(' gbk').strip())
            version = (0, 0, 0) if match is None else match.groups()

The code commented out above is the original ones. (This step is to avoid the format problem: utf-8 and gbk.)

Next, we should change the codes in "tasn-pytorch\src".

For "att_grid_generator_cuda.cpp", you should change all "AT_CHECK" into "TORCH_CHECK".

And for "att_grid_generator_cuda_kernel.cu", you should remove all the "const" of the parameters in fuction "attgridgen_gpu". Just like this:

void attgridgen_gpu(at::Tensor attx, at::Tensor atty,
    at::Tensor map_xi, at::Tensor map_yi,
    at::Tensor index_x, at::Tensor index_y,
    int batch_size, int att_size, int out_size, 
    float threshold, int iters)
{...}

Then, the call "python setup.py build" and "python setup.py install" can run successfully.

@Tracy-git
Copy link

thk so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants