tqchen commented on code in PR #16693:
URL: https://github.com/apache/tvm/pull/16693#discussion_r1518662899


##########
python/tvm/contrib/tvmjs.py:
##########
@@ -212,12 +224,15 @@ def dump_ndarray_cache(
         shard_manager.append(data, name=k, shape=shape, dtype=dtype, 
encode_format=encode_format)
 
         counter += 1
-        last_cmd = "[%04d/%04d] saving %s" % (counter, total, k)
+        if from_generator:
+            total_num += 1
+        last_cmd = "[%04d/%04d] saving %s" % (counter, total_num, k)

Review Comment:
   remove total_num from the progress if from generator since it can be strange



##########
python/tvm/contrib/tvmjs.py:
##########
@@ -159,27 +164,32 @@ def dump_ndarray_cache(
 
     Parameters
     ----------
-    params: Mapping[str, tvm.runtime.NDArray],
-        The parameter dictionary
+    params: Union[
+        Mapping[str, Union[np.ndarray, tvm.runtime.NDArray]],
+        Iterator[Tuple[str, Union[np.ndarray, tvm.runtime.NDArray]]],
+    ]
+        The parameter dictionary or generator
 
     cache_dir: str
         The path to the cache
 
     encode_format: {"f32-to-bf16", "raw"}
         Encoding format.
 
-    meta_data: json-compatible-struct
-        Extra meta_data to be stored in the cache json file.
+    meta_data: json-compatible-struct or Callable[[], Any]

Review Comment:
   add an option `show_progress=True`, which toggles progress print, since the 
caller may use other means(e.g. tqdm)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to