diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index e2714ed60..a8e5241b7 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -68,7 +68,8 @@ jobs: - name: Test visualize extra run: pytest tests/visualize - name: Install QDax - run: pip install qdax + # Brax 0.9.4 fails with Python 3.8 due to mujoco-mjx + run: pip install qdax brax==0.9.3 - name: Test visualize extra for QDax run: pytest tests/visualize_qdax - name: Install cma dep diff --git a/ribs/visualize/_cvt_archive_3d_plot.py b/ribs/visualize/_cvt_archive_3d_plot.py index 70c3a0223..4cb15b692 100644 --- a/ribs/visualize/_cvt_archive_3d_plot.py +++ b/ribs/visualize/_cvt_archive_3d_plot.py @@ -155,10 +155,10 @@ def cvt_archive_3d_plot( this argument instead of the data currently in the archive. This data can be obtained by, for instance, calling :meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"`` - and modifying the resulting :class:`ArchiveDataFrame`. Note that, at - a minimum, the data must contain columns for index, objective, and - measures. To display a custom metric, replace the "objective" - column. + and modifying the resulting + :class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum, + the data must contain columns for index, objective, and measures. To + display a custom metric, replace the "objective" column. measure_order (array-like of int): Specifies the axes order for plotting the measures. By default, the first measure (measure 0) in the archive appears on the x-axis, the second (measure 1) on y-axis, and diff --git a/ribs/visualize/_cvt_archive_heatmap.py b/ribs/visualize/_cvt_archive_heatmap.py index 6b8d9e123..612cb9778 100644 --- a/ribs/visualize/_cvt_archive_heatmap.py +++ b/ribs/visualize/_cvt_archive_heatmap.py @@ -103,10 +103,10 @@ def cvt_archive_heatmap(archive, this argument instead of the data currently in the archive. This data can be obtained by, for instance, calling :meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"`` - and modifying the resulting :class:`ArchiveDataFrame`. Note that, at - a minimum, the data must contain columns for index, objective, and - measures. To display a custom metric, replace the "objective" - column. + and modifying the resulting + :class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum, + the data must contain columns for index, objective, and measures. To + display a custom metric, replace the "objective" column. transpose_measures (bool): By default, the first measure in the archive will appear along the x-axis, and the second will be along the y-axis. To switch this behavior (i.e. to transpose the axes), set diff --git a/ribs/visualize/_grid_archive_heatmap.py b/ribs/visualize/_grid_archive_heatmap.py index 9db3333bd..bba3e5389 100644 --- a/ribs/visualize/_grid_archive_heatmap.py +++ b/ribs/visualize/_grid_archive_heatmap.py @@ -91,10 +91,10 @@ def grid_archive_heatmap(archive, this argument instead of the data currently in the archive. This data can be obtained by, for instance, calling :meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"`` - and modifying the resulting :class:`ArchiveDataFrame`. Note that, at - a minimum, the data must contain columns for index, objective, and - measures. To display a custom metric, replace the "objective" - column. + and modifying the resulting + :class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum, + the data must contain columns for index, objective, and measures. To + display a custom metric, replace the "objective" column. transpose_measures (bool): By default, the first measure in the archive will appear along the x-axis, and the second will be along the y-axis. To switch this behavior (i.e. to transpose the axes), set diff --git a/ribs/visualize/_parallel_axes_plot.py b/ribs/visualize/_parallel_axes_plot.py index 678ae04f0..e9c88312b 100644 --- a/ribs/visualize/_parallel_axes_plot.py +++ b/ribs/visualize/_parallel_axes_plot.py @@ -83,10 +83,10 @@ def parallel_axes_plot(archive, this argument instead of the data currently in the archive. This data can be obtained by, for instance, calling :meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"`` - and modifying the resulting :class:`ArchiveDataFrame`. Note that, at - a minimum, the data must contain columns for index, objective, and - measures. To display a custom metric, replace the "objective" - column. + and modifying the resulting + :class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum, + the data must contain columns for index, objective, and measures. To + display a custom metric, replace the "objective" column. measure_order (list of int or list of (int, str)): If this is a list of ints, it specifies the axes order for measures (e.g. ``[2, 0, 1]``). If this is a list of tuples, each tuple takes the form diff --git a/ribs/visualize/_sliding_boundaries_archive_heatmap.py b/ribs/visualize/_sliding_boundaries_archive_heatmap.py index fe7e4cf1a..0cc49a904 100644 --- a/ribs/visualize/_sliding_boundaries_archive_heatmap.py +++ b/ribs/visualize/_sliding_boundaries_archive_heatmap.py @@ -69,10 +69,10 @@ def sliding_boundaries_archive_heatmap(archive, this argument instead of the data currently in the archive. This data can be obtained by, for instance, calling :meth:`ribs.archives.ArchiveBase.data` with ``return_type="pandas"`` - and modifying the resulting :class:`ArchiveDataFrame`. Note that, at - a minimum, the data must contain columns for index, objective, and - measures. To display a custom metric, replace the "objective" - column. + and modifying the resulting + :class:`~ribs.archives.ArchiveDataFrame`. Note that, at a minimum, + the data must contain columns for index, objective, and measures. To + display a custom metric, replace the "objective" column. transpose_measures (bool): By default, the first measure in the archive will appear along the x-axis, and the second will be along the y-axis. To switch this behavior (i.e. to transpose the axes), set diff --git a/tutorials/mnist/train_mnist_classifier.py b/tutorials/mnist/train_mnist_classifier.py index 5a8968e1f..e421c900d 100644 --- a/tutorials/mnist/train_mnist_classifier.py +++ b/tutorials/mnist/train_mnist_classifier.py @@ -18,8 +18,8 @@ import sys import torch -import torch.nn as nn import torchvision +from torch import nn MEAN_TRANSFORM = 0.1307 STD_DEV_TRANSFORM = 0.3081 diff --git a/tutorials/tom_cruise_dqd.ipynb b/tutorials/tom_cruise_dqd.ipynb index 0a3c77a8a..d88398af8 100644 --- a/tutorials/tom_cruise_dqd.ipynb +++ b/tutorials/tom_cruise_dqd.ipynb @@ -950,7 +950,10 @@ " if not df_box.empty:\n", " # Select the solution with highest objective in the box.\n", " max_obj_idx = df_box['objective'].argmax()\n", - " sol = df_box.loc[:, \"solution_0\":].iloc[max_obj_idx]\n", + " # StyleGAN solutions have 7,168 dimensions, so the final solution col\n", + " # is solution_7167.\n", + " sol = df_box.loc[:, \"solution_0\":\"solution_7167\"].iloc[max_obj_idx]\n", + "\n", "\n", " # Convert the latent vector solution to an image.\n", " img = classifier.generate_image(np.array(sol))[0].cpu().detach()\n", @@ -996,11 +999,7 @@ ], "source": [ "def create_archive_tick_labels(measure_range, num_ticks):\n", - " low_pos = measure_range[0]\n", - " high_pos = measure_range[1]\n", - "\n", " delta = (measure_range[1]-measure_range[0])/num_ticks\n", - "\n", " ticklabels = [\n", " round( delta*p + measure_range[0], 3)\n", " for p in range(num_ticks+1)\n",