You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/09/22 05:59:22 UTC

[GitHub] [tvm] zxybazh opened a new pull request, #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

zxybazh opened a new pull request, #12866:
URL: https://github.com/apache/tvm/pull/12866

   Previously the tuning process would generate significant amount of logging to screen, which would be troublesome for jupyter notebook usage. This PR proposes several changes to fit in the usage on jupyter:
    - The output would automatically clean up each time a new tuning result table is generated.
    - Slim version of the table is available when ipython environment is used so that the table can fit in output area of the notebook.
    - Added progress.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1256642791

   uploading an jupyter notebook to gist would be great


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on a diff in pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on code in PR #12866:
URL: https://github.com/apache/tvm/pull/12866#discussion_r979183312


##########
src/meta_schedule/task_scheduler/gradient_based.cc:
##########
@@ -61,22 +61,43 @@ class GradientBasedNode final : public TaskSchedulerNode {
     int total_trials = 0;
     double total_latency = 0.0;
     support::TablePrinter p;
-    p.Row() << "ID"
-            << "Name"
-            << "FLOP"
-            << "Weight"
-            << "Speed (GFLOPS)"
-            << "Latency (us)"
-            << "Weighted Latency (us)"
-            << "Trials"
-            << "Terminated";
+
+    if (using_ipython()) {
+      p.Row() << "ID"
+              << "Name"
+              << "FLOP"
+              << "Weight"
+              << "GFLOPS"
+              << "Latency (us)"
+              << "Wtd. Latency"
+              << "Trials"
+              << "Terminated";
+    } else {
+      p.Row() << "ID"
+              << "Name"
+              << "FLOP"
+              << "Weight"
+              << "Speed (GFLOPS)"
+              << "Latency (us)"
+              << "Weighted Latency (us)"
+              << "Trials"
+              << "Terminated";
+    }
+
     p.Separator();
+
     for (int i = 0; i < n_tasks; ++i) {
       const TaskRecord& record = task_records_[i];
       auto row = p.Row();
       int trials = record.trials;
+      String task_name = record.task->task_name.value();
+      if (using_ipython() && task_name.length() > 23) {
+        std::string temp = task_name.c_str();
+        temp = temp.substr(0, 20) + "...";
+        task_name = String(temp);
+      }

Review Comment:
   This is indeed not ideal. We may have an extra API that allows us to assemble a pandas dataframe so that it’s more organically integrated with jupyter. I have an idea and will communicate with Xiyou next week



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1255333056

   @tvm-bot rerun


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on a diff in pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on code in PR #12866:
URL: https://github.com/apache/tvm/pull/12866#discussion_r978868793


##########
src/meta_schedule/task_scheduler/gradient_based.cc:
##########
@@ -178,6 +201,7 @@ class GradientBasedNode final : public TaskSchedulerNode {
     }
     record.best_time_cost_history.push_back(best_time_cost);
     record.trials += results.size();
+    TVM_PY_LOG(CLEAR, this->logging_func);

Review Comment:
   we might want to decouple the `TVM_PY_LOG` macro with screen clearing at interface level, in case one might misuse for example:
   
   ```python
       TVM_PY_LOG(CLEAR, this->logging_func) << "I'm expecting to print anything";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on a diff in pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on code in PR #12866:
URL: https://github.com/apache/tvm/pull/12866#discussion_r978869432


##########
src/meta_schedule/task_scheduler/gradient_based.cc:
##########
@@ -178,6 +201,7 @@ class GradientBasedNode final : public TaskSchedulerNode {
     }
     record.best_time_cost_history.push_back(best_time_cost);
     record.trials += results.size();
+    TVM_PY_LOG(CLEAR, this->logging_func);

Review Comment:
   How about:
   
   ```python
   TVM_PY_LOG_CLEAR_SCREEN(this->logging_func);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1256710654

   Really cool stuff! I'm happy with merging it in! Just a further question, do you think it's possible that we draw a jupyter table like what's done with Pandas DataFrame?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh merged pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
zxybazh merged PR #12866:
URL: https://github.com/apache/tvm/pull/12866


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1256652491

   Available here: https://gist.github.com/zxybazh/82665e01e94522deadc0646a428155ce


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1256448317

   For testing, I used `python tests/python/unittest/test_meta_schedule_tune_relay.py` for local cli testing, and I can also upload my notebook to gist for notebook testing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1255484956

   Hi YJ, I think this applies to all the ipython kernel based interface, yet I only tested on jupyter notebook. On the other hand we have progress as percentage available now so I'm not planning to add a progress bar (but definitely doable). IMHO other logs like `send xx samples` are useful information and won't take a lot of lines on the screen so I tend to keep them as they are, and they would be cleaned once a new table is printed out.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] MasterJH5574 commented on a diff in pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
MasterJH5574 commented on code in PR #12866:
URL: https://github.com/apache/tvm/pull/12866#discussion_r979154282


##########
src/meta_schedule/task_scheduler/gradient_based.cc:
##########
@@ -61,22 +61,43 @@ class GradientBasedNode final : public TaskSchedulerNode {
     int total_trials = 0;
     double total_latency = 0.0;
     support::TablePrinter p;
-    p.Row() << "ID"
-            << "Name"
-            << "FLOP"
-            << "Weight"
-            << "Speed (GFLOPS)"
-            << "Latency (us)"
-            << "Weighted Latency (us)"
-            << "Trials"
-            << "Terminated";
+
+    if (using_ipython()) {
+      p.Row() << "ID"
+              << "Name"
+              << "FLOP"
+              << "Weight"
+              << "GFLOPS"
+              << "Latency (us)"
+              << "Wtd. Latency"
+              << "Trials"
+              << "Terminated";
+    } else {
+      p.Row() << "ID"
+              << "Name"
+              << "FLOP"
+              << "Weight"
+              << "Speed (GFLOPS)"
+              << "Latency (us)"
+              << "Weighted Latency (us)"
+              << "Trials"
+              << "Terminated";
+    }
+
     p.Separator();
+
     for (int i = 0; i < n_tasks; ++i) {
       const TaskRecord& record = task_records_[i];
       auto row = p.Row();
       int trials = record.trials;
+      String task_name = record.task->task_name.value();
+      if (using_ipython() && task_name.length() > 23) {
+        std::string temp = task_name.c_str();
+        temp = temp.substr(0, 20) + "...";
+        task_name = String(temp);
+      }

Review Comment:
   Do we have alternative ways to print the whole task names? Like if a task name is too long, we can try to print the name in multiple lines.
   
   I’m thinking of this because I just noticed that in your example table, there are several lines with exactly the same prefix.
   ```
           6 | fused_nn_conv2d_add_... | 231612416 |      2 | 276.8975 |     836.4555 |    1672.9111 |     32 |            
           7 | fused_nn_conv2d_add_... | 231813120 |      2 | 100.5202 |    2306.1349 |    4612.2697 |     32 |            
           8 | fused_nn_conv2d_add_... | 115806208 |      1 | 139.2956 |     831.3701 |     831.3701 |     32 |            
   ```
   I think this will cause confusion. So perhaps we should try to resolve this problem? What do you think of this.
   
   Also cc @junrushao 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1257516448

   Thanks all for reviewing & we’ll further work on creating dataframe view or other directions to optimize jupyter notebook view in a separate PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] shingjan commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
shingjan commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1255370680

   This seems super useful. Do we want to extends this functionality to non-jupyter notebook? Essentially what I have in mind is that we can update the table & process bar and omit all other log info like `send xx samples to runner/builder`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #12866:
URL: https://github.com/apache/tvm/pull/12866#issuecomment-1256430722

   @zxybazh do you have a demo on gist?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on a diff in pull request #12866: [MetaSchedule][UX] User Interface for Jupyter Notebook

Posted by GitBox <gi...@apache.org>.
junrushao commented on code in PR #12866:
URL: https://github.com/apache/tvm/pull/12866#discussion_r978868793


##########
src/meta_schedule/task_scheduler/gradient_based.cc:
##########
@@ -178,6 +201,7 @@ class GradientBasedNode final : public TaskSchedulerNode {
     }
     record.best_time_cost_history.push_back(best_time_cost);
     record.trials += results.size();
+    TVM_PY_LOG(CLEAR, this->logging_func);

Review Comment:
   we might want to decouple the `TVM_PY_LOG` macro with screen clearing, in case one might misuse for example:
   
   ```suggestion
       TVM_PY_LOG(CLEAR, this->logging_func) << "I'm expecting to print anything";
   ```



##########
src/meta_schedule/task_scheduler/gradient_based.cc:
##########
@@ -178,6 +201,7 @@ class GradientBasedNode final : public TaskSchedulerNode {
     }
     record.best_time_cost_history.push_back(best_time_cost);
     record.trials += results.size();
+    TVM_PY_LOG(CLEAR, this->logging_func);

Review Comment:
   we might want to decouple the `TVM_PY_LOG` macro with screen clearing, in case one might misuse for example:
   
   ```python
       TVM_PY_LOG(CLEAR, this->logging_func) << "I'm expecting to print anything";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org