Skip to content

Commit

Permalink
Bump python deps (#406)
Browse files Browse the repository at this point in the history
This patch bumps all the python deps to more recent versions. Tensorflow is not bumped to the latest version as the last tf_agents release is only compatible with v2.15.0. We need to figure out what to do here, but this should still be an improvement that we can build off of.

The lockfile here was regenerated with Python 3.10, so probably will not be compatible with anything older.

This patch also contains changes related to the pytype bump.
  • Loading branch information
boomanaiden154 authored Dec 19, 2024
1 parent b6ee932 commit 8379a89
Show file tree
Hide file tree
Showing 9 changed files with 1,184 additions and 1,119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
task: [Typecheck, Lint, Yapf, Test]
include:
- task: Typecheck
cmd: pytype -j auto --overriding-parameter-count-checks .
cmd: pytype -j auto .
- task: Lint
cmd: pylint --rcfile .pylintrc --recursive yes .
- task: Yapf
Expand Down
19 changes: 10 additions & 9 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ verify_ssl = true
name = "pypi"

[packages]
absl-py = "==1.0.0"
absl-py = "==2.1.0"
gin-config = "==0.5.0"
psutil = "==5.9.0"
tf-agents = "==0.16.0"
tensorflow = "==2.12.0"
dm-reverb = "==0.11.0"
psutil = "==6.1.0"
tf-agents = "==0.19.0"
tensorflow = "==2.15.0"
dm-reverb = "==0.14.0"

[dev-packages]
pylint = "==3.3.2"
pytest = "==7.1.2"
pytype = "==2022.06.06"
pytest = "==8.3.4"
pytype = "==2024.10.11"
yapf = "==0.43.0"

[ci]
joblib = "==1.1.1"
shap = "==0.41.0"
joblib = "==1.4.2"
shap = "==0.46.0"

2,266 changes: 1,160 additions & 1,106 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions compiler_opt/es/blackbox_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
from compiler_opt.rl import policy_saver
from compiler_opt.es import blackbox_evaluator # pylint: disable=unused-import

# Pytype cannot pick up the pyi file for tensorflow.summary. Disable the error
# here as these errors are false positives.
# pytype: disable=pyi-error

# If less than 40% of requests succeed, skip the step.
_SKIP_STEP_SUCCESS_RATIO = 0.4

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,7 @@ def gen_trajectories(
)
not_done = result_futures
succeeded_idx = 0
succeeded: List[Optional[Tuple[Tuple[int, ProfilingDictValueType,
ProfilingDictValueType],
tf.train.SequenceExample]]] = []
succeeded = []

for written_files_idx in range(num_output_files):
written_per_file = 0
Expand Down
4 changes: 4 additions & 0 deletions compiler_opt/rl/train_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
from absl import logging
import gin

# Pytype cannot pick up the pyi file for tensorflow.summary. Disable the error
# here as these errors are false positives.
# pytype: disable=pyi-error

# <Internal> Using XM - flags. # pylint: disable=unused-import
from compiler_opt.rl import agent_config
from compiler_opt.rl import data_reader
Expand Down
2 changes: 2 additions & 0 deletions compiler_opt/rl/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ def train(self, dataset_iter, monitor_dict, num_iterations: int):
"""Trains policy with data from dataset_iter for num_iterations steps."""
self._reset_metrics()
# context management is implemented in decorator
# pytype: disable=attribute-error
# pylint: disable=not-context-manager
with tf.summary.record_if(lambda: tf.math.equal(
self._global_step % self._summary_export_interval, 0)):
# pytype: enable=attribute-error
for _ in range(num_iterations):
# When the data is not enough to fill in a batch, next(dataset_iter)
# will throw StopIteration exception, logging a warning message instead
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ filterwarnings =

# Issue #255
ignore:The line search algorithm did not converge

ignore:Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation.

0 comments on commit 8379a89

Please sign in to comment.