Skip to content

Commit

Permalink
synopsis: fix some pyright warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
garymm committed Nov 19, 2024
1 parent 5622ca9 commit 02dd6b9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions synopsis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"outputs": [],
"source": [
"!pip install -q \"git+https://github.com/Astera-org/jax_loop_utils[tf-data]\" flax"
"%pip install -q \"git+https://github.com/Astera-org/jax_loop_utils[tf-data]\" flax"
]
},
{
Expand Down Expand Up @@ -72,7 +72,7 @@
}
],
"source": [
"!pip show jax-loop-utils"
"%pip show jax-loop-utils"
]
},
{
Expand All @@ -84,8 +84,7 @@
"outputs": [],
"source": [
"import jax\n",
"import jax.numpy as jnp\n",
"import numpy as np"
"import jax.numpy as jnp"
]
},
{
Expand Down Expand Up @@ -208,15 +207,15 @@
],
"source": [
"import os\n",
"import pathlib\n",
"from jax_loop_utils import metric_writers\n",
"from jax_loop_utils.metric_writers.tf import SummaryWriter\n",
"import etils.epath as epath\n",
"\n",
"# Handy shortcut to create create async logging/tensorboard writer.\n",
"\n",
"\n",
"def create_default_writer(\n",
" logdir: epath.PathLike | None = None,\n",
" logdir: os.PathLike | None = None,\n",
" *,\n",
" just_logging: bool = False,\n",
" asynchronous: bool = True,\n",
Expand Down Expand Up @@ -254,7 +253,7 @@
" )\n",
" writers = [metric_writers.LoggingWriter(collection=collection)]\n",
" if logdir is not None:\n",
" logdir = epath.Path(logdir)\n",
" logdir = pathlib.Path(logdir)\n",
" if collection is not None:\n",
" logdir /= collection\n",
" writers.append(SummaryWriter(os.fspath(logdir)))\n",
Expand Down Expand Up @@ -538,7 +537,7 @@
"\n",
"@flax.struct.dataclass # <-- required for JAX transformations\n",
"class MyMetrics(metrics.Collection):\n",
" loss: metrics.Average.from_output(\"loss\")\n",
" loss: metrics.Average.from_output(\"loss\") # type: ignore[invalid-type-form]\n",
" accuracy: metrics.Accuracy\n",
"\n",
"\n",
Expand Down

0 comments on commit 02dd6b9

Please sign in to comment.