From 48bd1dd75f378050213216daeaf50f1096d0c2c8 Mon Sep 17 00:00:00 2001
From: Martin Kim <46072231+martinkim0@users.noreply.github.com>
Date: Thu, 7 Dec 2023 11:28:58 -0800
Subject: [PATCH] Fix autotune tutorial (#200)
---
tuning/autotune_scvi.ipynb | 332 +++----------------------------------
1 file changed, 25 insertions(+), 307 deletions(-)
diff --git a/tuning/autotune_scvi.ipynb b/tuning/autotune_scvi.ipynb
index 10c2f6e..3a5f5a2 100644
--- a/tuning/autotune_scvi.ipynb
+++ b/tuning/autotune_scvi.ipynb
@@ -53,7 +53,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -65,7 +65,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -81,24 +81,9 @@
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Global seed set to 0\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Last run with scvi-tools version: 1.0.3\n"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"scvi.settings.seed = 0\n",
"print(\"Last run with scvi-tools version:\", scvi.__version__)"
@@ -113,13 +98,14 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sc.set_figure_params(figsize=(4, 4), frameon=False)\n",
"torch.set_float32_matmul_precision(\"high\")\n",
"save_dir = tempfile.TemporaryDirectory()\n",
+ "scvi.settings.logging_dir = save_dir.name\n",
"\n",
"%config InlineBackend.print_figure_kwargs={\"facecolor\" : \"w\"}\n",
"%config InlineBackend.figure_format=\"retina\""
@@ -135,31 +121,9 @@
},
{
"cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[34mINFO \u001b[0m Downloading file at \u001b[35m/tmp/tmp51dvndw4/\u001b[0m\u001b[95mhca_subsampled_20k.h5ad\u001b[0m \n",
- "Downloading...: 100%|██████████| 65714/65714.0 [00:00<00:00, 110628.59it/s]\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "AnnData object with n_obs × n_vars = 18641 × 26662\n",
- " obs: 'NRP', 'age_group', 'cell_source', 'cell_type', 'donor', 'gender', 'n_counts', 'n_genes', 'percent_mito', 'percent_ribo', 'region', 'sample', 'scrublet_score', 'source', 'type', 'version', 'cell_states', 'Used'\n",
- " var: 'gene_ids-Harvard-Nuclei', 'feature_types-Harvard-Nuclei', 'gene_ids-Sanger-Nuclei', 'feature_types-Sanger-Nuclei', 'gene_ids-Sanger-Cells', 'feature_types-Sanger-Cells', 'gene_ids-Sanger-CD45', 'feature_types-Sanger-CD45', 'n_counts'\n",
- " uns: 'cell_type_colors'"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"adata = scvi.data.heart_cell_atlas_subsampled(save_path=save_dir.name)\n",
"adata"
@@ -175,23 +139,9 @@
},
{
"cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "AnnData object with n_obs × n_vars = 18641 × 2000\n",
- " obs: 'NRP', 'age_group', 'cell_source', 'cell_type', 'donor', 'gender', 'n_counts', 'n_genes', 'percent_mito', 'percent_ribo', 'region', 'sample', 'scrublet_score', 'source', 'type', 'version', 'cell_states', 'Used'\n",
- " var: 'gene_ids-Harvard-Nuclei', 'feature_types-Harvard-Nuclei', 'gene_ids-Sanger-Nuclei', 'feature_types-Sanger-Nuclei', 'gene_ids-Sanger-Cells', 'feature_types-Sanger-Cells', 'gene_ids-Sanger-CD45', 'feature_types-Sanger-CD45', 'n_counts', 'highly_variable', 'highly_variable_rank', 'means', 'variances', 'variances_norm'\n",
- " uns: 'cell_type_colors', 'hvg'"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"sc.pp.highly_variable_genes(adata, n_top_genes=2000, flavor=\"seurat_v3\", subset=True)\n",
"adata"
@@ -215,7 +165,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -233,7 +183,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -254,144 +204,9 @@
},
{
"cell_type": "code",
- "execution_count": 9,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
ModelTuner registry for SCVI\n",
- "
\n"
- ],
- "text/plain": [
- "ModelTuner registry for SCVI\n"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- " Tunable hyperparameters \n",
- "┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓\n",
- "┃ Hyperparameter ┃ Default value ┃ Source ┃\n",
- "┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩\n",
- "│ n_hidden │ 128 │ VAE │\n",
- "│ n_latent │ 10 │ VAE │\n",
- "│ n_layers │ 1 │ VAE │\n",
- "│ dropout_rate │ 0.1 │ VAE │\n",
- "│ dispersion │ gene │ VAE │\n",
- "│ log_variational │ True │ VAE │\n",
- "│ gene_likelihood │ zinb │ VAE │\n",
- "│ latent_distribution │ normal │ VAE │\n",
- "│ encode_covariates │ False │ VAE │\n",
- "│ deeply_inject_covariates │ True │ VAE │\n",
- "│ use_batch_norm │ both │ VAE │\n",
- "│ use_layer_norm │ none │ VAE │\n",
- "│ use_observed_lib_size │ True │ VAE │\n",
- "│ var_activation │ None │ VAE │\n",
- "│ optimizer │ Adam │ TrainingPlan │\n",
- "│ lr │ 0.001 │ TrainingPlan │\n",
- "│ weight_decay │ 1e-06 │ TrainingPlan │\n",
- "│ eps │ 0.01 │ TrainingPlan │\n",
- "│ n_steps_kl_warmup │ None │ TrainingPlan │\n",
- "│ n_epochs_kl_warmup │ 400 │ TrainingPlan │\n",
- "│ reduce_lr_on_plateau │ False │ TrainingPlan │\n",
- "│ lr_factor │ 0.6 │ TrainingPlan │\n",
- "│ lr_patience │ 30 │ TrainingPlan │\n",
- "│ lr_threshold │ 0.0 │ TrainingPlan │\n",
- "│ lr_min │ 0 │ TrainingPlan │\n",
- "│ max_kl_weight │ 1.0 │ TrainingPlan │\n",
- "│ min_kl_weight │ 0.0 │ TrainingPlan │\n",
- "└──────────────────────────┴───────────────┴──────────────┘\n",
- "
\n"
- ],
- "text/plain": [
- "\u001b[3m Tunable hyperparameters \u001b[0m\n",
- "┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓\n",
- "┃\u001b[1m \u001b[0m\u001b[1m Hyperparameter \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mDefault value\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Source \u001b[0m\u001b[1m \u001b[0m┃\n",
- "┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m n_hidden \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 128 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m n_latent \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 10 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m n_layers \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 1 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m dropout_rate \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0.1 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m dispersion \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m gene \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m log_variational \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m True \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m gene_likelihood \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m zinb \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m latent_distribution \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m normal \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m encode_covariates \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m False \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33mdeeply_inject_covariates\u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m True \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m use_batch_norm \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m both \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m use_layer_norm \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m none \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m use_observed_lib_size \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m True \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m var_activation \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m None \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m VAE \u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m optimizer \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m Adam \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m lr \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0.001 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m weight_decay \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 1e-06 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m eps \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0.01 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m n_steps_kl_warmup \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m None \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m n_epochs_kl_warmup \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 400 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m reduce_lr_on_plateau \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m False \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m lr_factor \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0.6 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m lr_patience \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 30 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m lr_threshold \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0.0 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m lr_min \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m max_kl_weight \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 1.0 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m min_kl_weight \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m 0.0 \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mTrainingPlan\u001b[0m\u001b[32m \u001b[0m│\n",
- "└──────────────────────────┴───────────────┴──────────────┘\n"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- " Available metrics \n",
- "┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓\n",
- "┃ Metric ┃ Mode ┃\n",
- "┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩\n",
- "│ validation_loss │ min │\n",
- "└─────────────────┴────────────┘\n",
- "
\n"
- ],
- "text/plain": [
- "\u001b[3m Available metrics \u001b[0m\n",
- "┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓\n",
- "┃\u001b[1m \u001b[0m\u001b[1m Metric \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Mode \u001b[0m\u001b[1m \u001b[0m┃\n",
- "┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33mvalidation_loss\u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m min \u001b[0m\u001b[38;5;128m \u001b[0m│\n",
- "└─────────────────┴────────────┘\n"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- " Default search space \n",
- "┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓\n",
- "┃ Hyperparameter ┃ Sample function ┃ Arguments ┃ Keyword arguments ┃\n",
- "┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩\n",
- "│ n_hidden │ choice │ [[64, 128]] │ {} │\n",
- "└────────────────┴─────────────────┴─────────────┴───────────────────┘\n",
- "
\n"
- ],
- "text/plain": [
- "\u001b[3m Default search space \u001b[0m\n",
- "┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓\n",
- "┃\u001b[1m \u001b[0m\u001b[1mHyperparameter\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mSample function\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Arguments \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mKeyword arguments\u001b[0m\u001b[1m \u001b[0m┃\n",
- "┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩\n",
- "│\u001b[38;5;33m \u001b[0m\u001b[38;5;33m n_hidden \u001b[0m\u001b[38;5;33m \u001b[0m│\u001b[38;5;128m \u001b[0m\u001b[38;5;128m choice \u001b[0m\u001b[38;5;128m \u001b[0m│\u001b[32m \u001b[0m\u001b[32m[[64, 128]]\u001b[0m\u001b[32m \u001b[0m│\u001b[38;5;208m \u001b[0m\u001b[38;5;208m {} \u001b[0m\u001b[38;5;208m \u001b[0m│\n",
- "└────────────────┴─────────────────┴─────────────┴───────────────────┘\n"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"scvi_tuner.info()"
]
@@ -414,7 +229,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -460,97 +275,9 @@
},
{
"cell_type": "code",
- "execution_count": 11,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
\n",
- "
\n",
- "
Tune Status
\n",
- "
\n",
- "\n",
- "Current time: | 2023-07-27 03:16:53 |
\n",
- "Running for: | 00:02:40.69 |
\n",
- "Memory: | 34.8/125.7 GiB |
\n",
- "\n",
- "
\n",
- "
\n",
- "
\n",
- "
\n",
- "
System Info
\n",
- " Using AsyncHyperBand: num_stopped=5
Bracket: Iter 64.000: -451.93446350097656 | Iter 32.000: -453.1311798095703 | Iter 16.000: -459.6698303222656 | Iter 8.000: -469.3856506347656 | Iter 4.000: -481.6686248779297 | Iter 2.000: -517.1959228515625 | Iter 1.000: -642.4600219726562
Logical resource usage: 10.0/20 CPUs, 1.0/1 GPUs (0.0/1.0 accelerator_type:G)\n",
- " \n",
- " \n",
- "
\n",
- "
\n",
- "
\n",
- "
Trial Status
\n",
- "
\n",
- "\n",
- "Trial name | status | loc | n_hidden | n_layers | lr | validation_loss |
\n",
- "\n",
- "\n",
- "_trainable_9ca2fa7c | TERMINATED | 128.32.142.133:965309 | 256 | 3 | 0.000589003 | 455.212 |
\n",
- "_trainable_7d98a8b2 | TERMINATED | 128.32.142.133:965309 | 64 | 2 | 0.000350049 | 737.187 |
\n",
- "_trainable_ff1772f6 | TERMINATED | 128.32.142.133:965309 | 64 | 3 | 0.000918661 | 556.365 |
\n",
- "_trainable_5fa3a6f6 | TERMINATED | 128.32.142.133:965309 | 256 | 3 | 0.000161977 | 770.872 |
\n",
- "_trainable_53fa3aa1 | TERMINATED | 128.32.142.133:965309 | 128 | 1 | 0.00122786 | 452.142 |
\n",
- "\n",
- "
\n",
- "
\n",
- "
\n",
- "\n"
- ],
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/home/martin/bin/mambaforge/envs/scvi-tools-dev/lib/python3.11/site-packages/ray/air/config.py:803: UserWarning: Setting a `RunConfig.local_dir` is deprecated and will be removed in the future. If you are not using remote storage,set the `RunConfig.storage_path` instead. Otherwise, set the`RAY_AIR_LOCAL_CACHE_DIR` environment variable to control the local cache location.\n",
- " warnings.warn(\n",
- "2023-07-27 03:14:12,825\tINFO tune.py:657 -- [output] This uses the legacy output and progress reporter, as Jupyter notebooks are not supported by the new engine, yet. For more information, please see https://github.com/ray-project/ray/issues/36949\n",
- "2023-07-27 03:16:53,535\tINFO tune.py:1148 -- Total run time: 160.71 seconds (160.69 seconds for the tuning loop).\n"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"ray.init(log_to_driver=False)\n",
"results = scvi_tuner.fit(\n",
@@ -565,18 +292,9 @@
},
{
"cell_type": "code",
- "execution_count": 12,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "{'n_hidden': 128, 'n_layers': 1}\n",
- "{'plan_kwargs': {'lr': 0.001227857394187722}}\n"
- ]
- }
- ],
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
"source": [
"print(results.model_kwargs)\n",
"print(results.train_kwargs)"