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

fix: Fixing pybind error on nightly #1285

Merged
merged 3 commits into from
Sep 13, 2022
Merged

fix: Fixing pybind error on nightly #1285

merged 3 commits into from
Sep 13, 2022

Conversation

andi4191
Copy link
Contributor

@andi4191 andi4191 commented Aug 18, 2022

Signed-off-by: Anurag Dixit a.dixit91@gmail.com

Description

Fixing the failures for pybind related on nightly builds in circleci
Fixes # (issue)

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>
@andi4191 andi4191 added WIP Work is in progress, pull request should not be merged yet and removed cla signed labels Aug 18, 2022
@github-actions github-actions bot added the component: api [Python] Issues re: Python API label Aug 18, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to C++ style guidelines:

diff --git a/workspace/py/torch_tensorrt/csrc/torch_tensorrt_py.cpp b/tmp/changes.txt
index 8e18dfa..4b87dea 100644
--- a/workspace/py/torch_tensorrt/csrc/torch_tensorrt_py.cpp
+++ b/tmp/changes.txt
@@ -25,11 +25,9 @@ class pyCalibratorTrampoline : public Derived {
  int getBatchSize() const noexcept override {
    try {
      PYBIND11_OVERLOAD_PURE_NAME(int, Derived, "get_batch_size", getBatchSize);
-    }
-    catch(std::exception const &e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_batch_size" + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_batch_size");
    }
    return -1;
@@ -83,11 +81,9 @@ class pyIInt8Calibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Calibrato
    try {
      PYBIND11_OVERLOAD_PURE_NAME(
          nvinfer1::CalibrationAlgoType, nvinfer1::IInt8Calibrator, "get_algorithm", getAlgorithm);
-    }
-    catch(std::exception const &e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_algorithm: " + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_algorithm");
    }
    return {};
@@ -102,11 +98,9 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg
  double getQuantile() const noexcept override {
    try {
      PYBIND11_OVERLOAD_PURE_NAME(double, nvinfer1::IInt8LegacyCalibrator, "get_quantile", getQuantile);
-    }
-    catch(std::exception const &e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_quantile: " + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_quantile");
    }
    return -1.0;
@@ -114,12 +108,11 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg

  double getRegressionCutoff() const noexcept override {
    try {
-      PYBIND11_OVERLOAD_PURE_NAME(double, nvinfer1::IInt8LegacyCalibrator, "get_regression_cutoff", getRegressionCutoff);
-    }
-    catch(std::exception const &e) {
+      PYBIND11_OVERLOAD_PURE_NAME(
+          double, nvinfer1::IInt8LegacyCalibrator, "get_regression_cutoff", getRegressionCutoff);
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_regression_cutoff: " + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_regression_cutoff");
    }
    return -1.0;
@@ -129,11 +122,9 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg
    try {
      PYBIND11_OVERLOAD_PURE_NAME(
          const char*, nvinfer1::IInt8LegacyCalibrator, "read_histogram_cache", readHistogramCache, length);
-    }
-    catch(std::exception const& e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in read_histogram_cache" + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in read_histogram_cache");
    }
    return {};
@@ -143,11 +134,9 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg
    try {
      PYBIND11_OVERLOAD_PURE_NAME(
          void, nvinfer1::IInt8LegacyCalibrator, "write_histogram_cache", writeHistogramCache, ptr, length);
-    }
-    catch(std::exception const& e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in write_histogram_cache" + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in write_histogram_cache");
    }
  }
ERROR: Some files do not conform to style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

@andi4191 andi4191 removed the WIP Work is in progress, pull request should not be merged yet label Aug 18, 2022
@andi4191 andi4191 changed the title fix: Fixing pybind error on nightly [TEST PR][DO NOT MERGE YET] fix: Fixing pybind error on nightly Aug 18, 2022
@andi4191 andi4191 self-assigned this Aug 18, 2022
@andi4191 andi4191 added the Upstreaming PR Upstreaming changes from an NGC release branch label Aug 18, 2022
@andi4191 andi4191 requested a review from peri044 August 18, 2022 20:25
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some changes that do not conform to C++ style guidelines:

diff --git a/workspace/py/torch_tensorrt/csrc/torch_tensorrt_py.cpp b/tmp/changes.txt
index 8e18dfa..4b87dea 100644
--- a/workspace/py/torch_tensorrt/csrc/torch_tensorrt_py.cpp
+++ b/tmp/changes.txt
@@ -25,11 +25,9 @@ class pyCalibratorTrampoline : public Derived {
  int getBatchSize() const noexcept override {
    try {
      PYBIND11_OVERLOAD_PURE_NAME(int, Derived, "get_batch_size", getBatchSize);
-    }
-    catch(std::exception const &e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_batch_size" + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_batch_size");
    }
    return -1;
@@ -83,11 +81,9 @@ class pyIInt8Calibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Calibrato
    try {
      PYBIND11_OVERLOAD_PURE_NAME(
          nvinfer1::CalibrationAlgoType, nvinfer1::IInt8Calibrator, "get_algorithm", getAlgorithm);
-    }
-    catch(std::exception const &e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_algorithm: " + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_algorithm");
    }
    return {};
@@ -102,11 +98,9 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg
  double getQuantile() const noexcept override {
    try {
      PYBIND11_OVERLOAD_PURE_NAME(double, nvinfer1::IInt8LegacyCalibrator, "get_quantile", getQuantile);
-    }
-    catch(std::exception const &e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_quantile: " + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_quantile");
    }
    return -1.0;
@@ -114,12 +108,11 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg

  double getRegressionCutoff() const noexcept override {
    try {
-      PYBIND11_OVERLOAD_PURE_NAME(double, nvinfer1::IInt8LegacyCalibrator, "get_regression_cutoff", getRegressionCutoff);
-    }
-    catch(std::exception const &e) {
+      PYBIND11_OVERLOAD_PURE_NAME(
+          double, nvinfer1::IInt8LegacyCalibrator, "get_regression_cutoff", getRegressionCutoff);
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in get_regression_cutoff: " + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in get_regression_cutoff");
    }
    return -1.0;
@@ -129,11 +122,9 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg
    try {
      PYBIND11_OVERLOAD_PURE_NAME(
          const char*, nvinfer1::IInt8LegacyCalibrator, "read_histogram_cache", readHistogramCache, length);
-    }
-    catch(std::exception const& e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in read_histogram_cache" + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in read_histogram_cache");
    }
    return {};
@@ -143,11 +134,9 @@ class pyIInt8LegacyCalibrator : public pyCalibratorTrampoline<nvinfer1::IInt8Leg
    try {
      PYBIND11_OVERLOAD_PURE_NAME(
          void, nvinfer1::IInt8LegacyCalibrator, "write_histogram_cache", writeHistogramCache, ptr, length);
-    }
-    catch(std::exception const& e) {
+    } catch (std::exception const& e) {
      LOG_ERROR("Exception caught in write_histogram_cache" + std::string(e.what()));
-    }
-    catch(...) {
+    } catch (...) {
      LOG_ERROR("Exception caught in write_histogram_cache");
    }
  }
ERROR: Some files do not conform to style guidelines

@narendasan
Copy link
Collaborator

Can you run pre-commit install then pre-commit run --all-files

Signed-off-by: Anurag Dixit <a.dixit91@gmail.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@narendasan narendasan merged commit 83a9890 into master Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: api [Python] Issues re: Python API Upstreaming PR Upstreaming changes from an NGC release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants