oss-gate / workshop

OSSの開発に未参加または参加したことはあるけどまだ自信がない人を後押しするワークショップ用のリポジトリー
124 stars 547 forks source link

OSS Gate Workshop: PyConJP 2020 Sprint: 2020-08-23: norihitoishida: Optuna: Work log #1408

Closed norihitoishida closed 4 years ago

norihitoishida commented 4 years ago

This is a work log of a "OSS Gate workshop". "OSS Gate workshop" is an activity to increase OSS developers. Here's been discussed in Japanese. Thanks.

OSS Gateワークショップ関連情報

norihitoishida commented 4 years ago

OptunaのライセンスがMIT Licenseであることを確認した。

norihitoishida commented 4 years ago

型ヒントのissueに着手。 Chainer対応のPRを出し、レビュアの方の意見を元に修正。

大変だったこと

思ったこと

norihitoishida commented 4 years ago

サポーターさんからの意見

norihitoishida commented 4 years ago

OptunaのContribution Guidelinesを確認した

norihitoishida commented 4 years ago

ChainerMN対応に着手 optuna/integration/chainermn.py

作業ログ

Tests (Integration)

Link

==================================== ERRORS ====================================
__________ ERROR collecting tests/integration_tests/test_chainermn.py __________
tests/integration_tests/test_chainermn.py:8: in <module>
    from optuna.integration import ChainerMNStudy
<frozen importlib._bootstrap>:1012: in _handle_fromlist
    ???
optuna/integration/__init__.py:81: in __getattr__
    module = self._get_module(self._class_to_module[name])
optuna/integration/__init__.py:93: in _get_module
    return importlib.import_module("." + module_name, self.__name__)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
optuna/integration/chainermn.py:31: in <module>
    class _ChainerMNObjectiveFunc(object):
optuna/integration/chainermn.py:45: in _ChainerMNObjectiveFunc
    self, func: Callable[["ChainerMNTrial", CommunicatorBase], float], comm: CommunicatorBase
E   NameError: name 'Callable' is not defined
=============================== warnings summary ===============================
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/site-packages/tensorflow/python/autograph/utils/testing.py:21
  /opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/site-packages/tensorflow/python/autograph/utils/testing.py:21: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/site-packages/xgboost/__init__.py:29
  /opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/site-packages/xgboost/__init__.py:29: FutureWarning: Python 3.5 support is deprecated; XGBoost will require Python 3.6+ in the near future. Consider upgrading to Python 3.6+.
    FutureWarning)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
ERROR tests/integration_tests/test_chainermn.py - NameError: name 'Callable' ...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 2 warnings, 1 error in 5.61s =========================
##[error]Process completed with exit code 2.

ci/circleci: doctest

Link

#!/bin/bash -eo pipefail
. venv/bin/activate
cd docs
make doctest
Running Sphinx v3.0.4
making output directory... done
[autosummary] generating autosummary for: faq.rst, index.rst, installation.rst, privacy.rst, reference/cli.rst, reference/distributions.rst, reference/exceptions.rst, reference/importance.rst, reference/index.rst, reference/integration.rst, ..., reference/multi_objective/trial.rst, reference/multi_objective/visualization.rst, reference/optuna.rst, reference/pruners.rst, reference/samplers.rst, reference/storages.rst, reference/structs.rst, reference/study.rst, reference/trial.rst, reference/visualization.rst

Exception occurred:
  File "/home/docs/project/venv/lib/python3.8/site-packages/optuna/integration/chainermn.py", line 45, in _ChainerMNObjectiveFunc
    self, func: Callable[["ChainerMNTrial", CommunicatorBase], float], comm: CommunicatorBase
NameError: name 'Callable' is not defined
The full traceback has been saved in /tmp/sphinx-err-1mi9nrqs.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
Makefile:20: recipe for target 'doctest' failed
make: *** [doctest] Error 2

Exited with code exit status 2
CircleCI received exit code 2

ci/circleci: document

Link

ci/circleci: document artifact

ci/circleci: tests-

Link

norihitoishida commented 4 years ago
norihitoishida commented 4 years ago
norihitoishida commented 4 years ago

Chainermn.py 完了!

norihitoishida commented 4 years ago
norihitoishida commented 4 years ago
norihitoishida commented 4 years ago
norihitoishida commented 4 years ago
norihitoishida commented 4 years ago
norihitoishida commented 4 years ago

悪い例

Example:
            .. testcode::
                import optuna

                def objective(trial):
                    x = trial.suggest_uniform("x", -1, 1)
                    return x ** 2

                study = optuna.create_study()
                study.optimize(objective, n_trials=3)

                trials = study.get_trials()

↑のように、.. testcode::import optunaの間に空行を入れてなかったので、optunaがimortされておらず、doctestに落ちていました。修正。

norihitoishida commented 4 years ago
norihitoishida commented 4 years ago

Sprintが終了したためisuueを閉じます。 1週間本当にありがとうございました!

kou commented 4 years ago

たくさんpull requestをだしましたね! これからもOptunaや他のOSSの開発に参加していってみてください!

今回の機会が有意義だったと思ったらまわりの人にこのOSS Gateという取り組みを紹介してください。 また、他の人たちにも同じような経験をして欲しいと思ったらOSS Gateワークショップのサポーターとして参加してみてください。次回以降のことなどは https://gitter.im/oss-gate/tokyo で相談しています。 私たちはOSSの開発に参加する人を増やし続けていきたいと思っています!