Antibody_deep_learning / scripts /06_export_gan_npz.R
anzhi2710gmailcom's picture
Upload folder using huggingface_hub
fe8e241 verified
Raw
History Blame Contribute Delete
774 Bytes
args <- commandArgs(trailingOnly = FALSE)
script_arg <- grep("^--file=", args, value = TRUE)
if (length(script_arg) > 0) {
script_path <- normalizePath(sub("^--file=", "", script_arg[1]))
setwd(normalizePath(file.path(dirname(script_path), "..")))
}
library(reticulate)
use_python(Sys.getenv("RETICULATE_PYTHON"), required = TRUE)
np <- import("numpy", convert = FALSE)
encoded <- readRDS("model/GAN/seq_all_encoded.RDS")
names_encoded <- names(encoded)
for (i in seq_along(encoded)) {
out_file <- sprintf("model/GAN/seq_encoded_%02d.npz", i)
np$savez_compressed(
out_file,
x = np$array(encoded[[i]], dtype = "float32"),
name = names_encoded[[i]]
)
cat("saved", out_file, names_encoded[[i]], dim(encoded[[i]]), "\n")
}
cat("export GAN npz OK\n")