Skip to content

Commit

Permalink
Correct and rerun hub intro tutorial (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkim0 authored Feb 2, 2024
1 parent e18b351 commit e773cc9
Showing 1 changed file with 59 additions and 39 deletions.
98 changes: 59 additions & 39 deletions hub/scvi_hub_intro_and_download.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,37 @@
"id": "c78df63c",
"metadata": {},
"source": [
"Uncomment the following lines in Google Colab in order to install `scvi-tools`:"
"```{note}\n",
"Running the following cell will install tutorial dependencies on Google Colab only. It will have no effect on environments other than Google Colab.\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "26d9e3c8",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/martinkim/bin/miniforge3/envs/scvi-11/lib/python3.11/site-packages/scvi_colab/_core.py:41: UserWarning: \n",
" Not currently in Google Colab environment.\n",
"\n",
" Please run with `run_outside_colab=True` to override.\n",
"\n",
" Returning with no further action.\n",
" \n",
" warn(\n"
]
}
],
"source": [
"# !pip install --quiet scvi-colab\n",
"# from scvi_colab import install\n",
"!pip install --quiet scvi-colab\n",
"from scvi_colab import install\n",
"\n",
"# install()"
"install()"
]
},
{
Expand All @@ -53,11 +70,18 @@
"id": "ce72c6b4",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Seed set to 0\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Last run with scvi-tools version: 1.0.3\n"
"Last run with scvi-tools version: 1.1.0rc2\n"
]
}
],
Expand All @@ -71,7 +95,9 @@
"id": "2e161542",
"metadata": {},
"source": [
"You can modify `save_dir` below to change where the data files for this tutorial are saved."
"```{note}\n",
"You can modify `save_dir` below to change where the data files for this tutorial are saved.\n",
"```"
]
},
{
Expand Down Expand Up @@ -308,7 +334,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c62bff650893402387f2453e03750c93",
"model_id": "1ea49f2e748948ed951d11724087c5bc",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -322,12 +348,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6219bc54fb6548dfbdbf06736ade3349",
"model_id": "373dd1ad49a6458b9ea00ee1d0b4ec02",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Downloading (…)38b80e180/adata.h5ad: 0%| | 0.00/526k [00:00<?, ?B/s]"
"adata.h5ad: 0%| | 0.00/1.01M [00:00<?, ?B/s]"
]
},
"metadata": {},
Expand All @@ -336,12 +362,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "af24e629ac1846ebacabe1b8295ec0f9",
"model_id": "e27f8cc038e84d2d81611fb2c7caecbf",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Downloading (…)quired_metadata.json: 0%| | 0.00/165 [00:00<?, ?B/s]"
"model.pt: 0%| | 0.00/304k [00:00<?, ?B/s]"
]
},
"metadata": {},
Expand All @@ -350,12 +376,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f57ba8aaf8364d22bb7351b79869d823",
"model_id": "a3a76ba3278c4834aa30e929ca987ac8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Downloading model.pt: 0%| | 0.00/304k [00:00<?, ?B/s]"
"_scvi_required_metadata.json: 0%| | 0.00/172 [00:00<?, ?B/s]"
]
},
"metadata": {},
Expand All @@ -364,7 +390,7 @@
],
"source": [
"hmo = HubModel.pull_from_huggingface_hub(\n",
" repo_name=\"scvi-tools/demo-model\",\n",
" repo_name=\"scvi-tools/test-scvi\",\n",
" cache_dir=save_dir.name,\n",
" revision=\"main\",\n",
")"
Expand Down Expand Up @@ -395,8 +421,22 @@
"text": [
"\u001b[34mINFO \u001b[0m Loading model\u001b[33m...\u001b[0m \n",
"\u001b[34mINFO \u001b[0m File \n",
" \u001b[35m/tmp/tmpmuir791g/models--scvi-tools--demo-model/snapshots/59afc89bcc6ceb43e91e8e98d21805a38b80e180/\u001b[0m\u001b[95mmodel.p\u001b[0m\n",
" \u001b[95mt\u001b[0m already downloaded \n"
" \u001b[35m/tmp/tmprdl64_l0/models--scvi-tools--test-scvi/snapshots/e6d2074cc12961f99af4e72b7ae5d0e63e2cb99d/\u001b[0m\u001b[95mmodel.pt\u001b[0m\n",
" already downloaded \n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/martinkim/bin/miniforge3/envs/scvi-11/lib/python3.11/site-packages/anndata/__init__.py:51: FutureWarning: `anndata.read` is deprecated, use `anndata.read_h5ad` instead. `ad.read` will be removed in mid 2024.\n",
" warnings.warn(\n",
"<frozen abc>:119: FutureWarning: SparseDataset is deprecated and will be removed in late 2024. It has been replaced by the public classes CSRDataset and CSCDataset.\n",
"\n",
"For instance checks, use `isinstance(X, (anndata.experimental.CSRDataset, anndata.experimental.CSCDataset))` instead.\n",
"\n",
"For creation, use `anndata.experimental.sparse_dataset(X)` instead.\n",
"\n"
]
},
{
Expand Down Expand Up @@ -452,7 +492,7 @@
"AnnData object with n_obs × n_vars = 400 × 100\n",
" obs: 'batch', 'labels', '_scvi_batch', '_scvi_labels'\n",
" uns: '_scvi_manager_uuid', '_scvi_uuid', 'protein_names'\n",
" obsm: 'protein_expression'"
" obsm: 'accessibility', 'protein_expression'"
]
},
"execution_count": 8,
Expand Down Expand Up @@ -536,26 +576,6 @@
"\n",
"Please browse the scvi-tools tutorials for explicit examples using scvi-hub in workflows."
]
},
{
"cell_type": "markdown",
"id": "931009ca",
"metadata": {},
"source": [
"## Clean up\n",
"\n",
"Uncomment the following line to remove all data files created in this tutorial:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "b9a1ddf8",
"metadata": {},
"outputs": [],
"source": [
"# save_dir.cleanup()"
]
}
],
"metadata": {
Expand All @@ -574,7 +594,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.7"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit e773cc9

Please sign in to comment.