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

Suppressed UserWarning: TORCH_CUDA_ARCH_LIST #3160

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
10 changes: 10 additions & 0 deletions examples/post_training_quantization/torch/mobilenet_v2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import re
import subprocess
from functools import partial
Expand All @@ -34,6 +35,14 @@
DATASET_CLASSES = 10


def set_cuda_arch_list():
if "TORCH_CUDA_ARCH_LIST" not in os.environ:
arch_list = torch.cuda.get_arch_list()
formatted_arch_list = [str(int(arch.split("_")[1]) / 10.0) for arch in arch_list]
arch_string = ";".join(formatted_arch_list)
os.environ["TORCH_CUDA_ARCH_LIST"] = arch_string


def download_dataset() -> Path:
downloader = FastDownload(base=DATASET_PATH.resolve(), archive="downloaded", data="extracted")
return downloader.get(DATASET_URL)
Expand Down Expand Up @@ -94,6 +103,7 @@ def get_model_size(ir_path: Path, m_type: str = "Mb") -> float:

###############################################################################
# Create a PyTorch model and dataset
set_cuda_arch_list()

dataset_path = download_dataset()

Expand Down