I'm trying scAlign on large datasets and found that the current implementation couldn't handle them.
Here's the output message when I ran it on the HumanPancreas Dataset (14890 cells x 34363 genes):
(everything ok back here)
[1] "Done random initialization"
2020-09-01 22:48:53.644928: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
[1] "Step: 1 Loss: 119.6789"
[1] "Error during alignment, returning scAlign class."
<Rcpp::exception in py_call_impl(callable, dots$args, dots$keywords): ValueError: Cannot create a tensor proto whose content is larger than 2GB.
Detailed traceback:
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\ops\nn_impl.py", line 616, in l2_normalize
return l2_normalize_v2(x, axis, epsilon, name)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\ops\nn_impl.py", line 642, in l2_normalize_v2
x = ops.convert_to_tensor(x, name="x")
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1184, in convert_to_tensor
return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1242, in convert_to_tensor_v2
as_ref=False)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1297, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\tensor_conversion_registry.py", line 52, in _default_conversion_function
return constant_op.constant(value, dtype, name=name)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\constant_op.py", line 227, in constant
allow_broadcast=True)
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\constant_op.py", line 265, in _constant_impl
allow_broadcast=allow_broadcast))
File "d:\programdata\anaconda3\lib\site-packages\tensorflow_core\python\framework\tensor_util.py", line 520, in make_tensor_proto
"Cannot create a tensor proto whose content is larger than 2GB.")
>
I tracked down the problem to the embedding saving process, where the whole dataset is l2-normalized by the following statement (in train_encoder.R
and train_encoder_multi.R
):
which results in the aforementioned error.
Could you please add a per batch l2-normalization feature at embedding generation? Specifically, when the dataset is too large, could you split it into batches and l2-normalize each batch before putting it into the encoder network? That would be most useful for my project, thank you!