Developer chat

I updated from 1.0.43.post1 to 1.0.47 and the ImageDataBunch creation for object detection is now much much faster, specifically the call to label_from_func which took 10s of seconds and now is instantaneous. I’m curious which change was responsible for this speedup. Great job!!

There was a bug where we were loading all the targets at creation, which required opening all the images to get their sizes. Fixed it and we’re back to things being loaded on the fly when needed, that’s why it’s now faster!

3 Likes

No reason, you can add it in the init.

1 Like

fyi, fastai-1.0.47-post1 has been released with all the hot fixes backported since 1.0.47 release till now.

List of fixes: https://github.com/fastai/fastai/commits/release-1.0.47

fit_one_cycle seems to be broken in 1.0.47. Using Lesson #9’s SSD model, I have two modes of training:

ssd.learn.fit(50, lr=0.004)
fit_one_cycle(ssd.learn, cyc_len=30, max_lr=0.004)

The first one runs fine, but the second on with fit_one_cycle hangs during the metric callback. Also it takes about 6x time to finish the validation loss computation.

I’ll take a look later but just wanted to mention this in case someone has a hint what may be happening here.

Thanks for the report, @vha14

This is always a great opportunity to add a new test that fails, since our current test suite has no problems.

Since the callbacks were revamped it’s possible that some weren’t ported correctly. So having a test that fails makes it much easier to identify and fix the problem and avoid causing it again in the future.

Thank you.

And using our newly released test regisry,
https://docs.fast.ai/basic_train.html#fit_one_cycle - click on [test], gives you:

Tests found for fit_one_cycle :

  • pytest -sv tests/test_callback.py::test_callbacks_fit [source]
  • pytest -sv tests/test_train.py::test_fit_one_cycle [source]

so that you have it if you need to find a starting point to build upon.

1 Like

Hi @stas,
One of the changes in version 1.0.47-post1 has been the removal of create_cnn
and its replacement by create_cnn_model in the list of exported methods (see
this commit) which doesn’t seem to match it in usage, and might not be needed as its replacement method cnn_learner has already been previously incorporated.

This also broke a lot of the existing notebooks and documentation including the videos (since they all refer to create_cnn) so I might suggest adding it back to the list of exported methods with the current deprecation to allow for a smoother transition?

Best regards,
Butch

Hey guys, I would like to make a PR for a simple bug fix but I am stuck following this guide…fast.ai - How to make a pull request

When I call make test in step 5, I get the following error:

E /bin/sh: 1: /usr/local/cuda/bin/nvcc: not found

The full error message is listed below. Also if I try to import fastai in my notebooks it no longer works. I’m guessing this is because I uninstalled fastai in the previous step but haven’t finished replacing it with my own branch. Please help if you can. Thanks.

``make test
python setup.py --quiet test
warning: no previously-included files matching ‘pycache’ found under directory ‘*’
warning: no files found matching ‘conf.py’ under directory ‘docs’
warning: no files found matching ‘Makefile’ under directory ‘docs’
warning: no files found matching ‘make.bat’ under directory ‘docs’
============================= test session starts ==============================
platform linux – Python 3.6.8, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /notebooks/fastai-fork, inifile: setup.cfg
plugins: xdist-1.26.1, forked-1.0.2
collected 256 items / 1 errors / 255 selected

==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_text_qrnn.py ___________________
/opt/conda/envs/fastai/lib/python3.6/site-packages/torch/utils/cpp_extension.py:946: in _build_extension_module
check=True)
/opt/conda/envs/fastai/lib/python3.6/subprocess.py:438: in run
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command ‘[‘ninja’, ‘-v’]’ returned non-zero exit status 1.

During handling of the above exception, another exception occurred:
tests/test_text_qrnn.py:3: in
from fastai.text.models import qrnn
fastai/text/models/qrnn.py:11: in
forget_mult_cuda = load(name=‘forget_mult_cuda’, sources=[fastai_path/f for f in files])
/opt/conda/envs/fastai/lib/python3.6/site-packages/torch/utils/cpp_extension.py:645: in load
is_python_module)
/opt/conda/envs/fastai/lib/python3.6/site-packages/torch/utils/cpp_extension.py:814: in jit_compile
with_cuda=with_cuda)
/opt/conda/envs/fastai/lib/python3.6/site-packages/torch/utils/cpp_extension.py:863: in write_ninja_file_and_build
build_extension_module(name, build_directory, verbose)
/opt/conda/envs/fastai/lib/python3.6/site-packages/torch/utils/cpp_extension.py:959: in build_extension_module
raise RuntimeError(message)
E RuntimeError: Error building extension ‘forget_mult_cuda’: [1/2] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=forget_mult_cuda -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include/TH -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/envs/fastai/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS
-D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS__ --compiler-options ‘-fPIC’ -std=c++11 -c /notebooks/fastai-fork/fastai/text/models/forget_mult_cuda_kernel.cu -o forget_mult_cuda_kernel.cuda.o
E FAILED: forget_mult_cuda_kernel.cuda.o
E /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=forget_mult_cuda -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include/TH -isystem /opt/conda/envs/fastai/lib/python3.6/site-packages/torch/lib/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/envs/fastai/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options ‘-fPIC’ -std=c++11 -c /notebooks/fastai-fork/fastai/text/models/forget_mult_cuda_kernel.cu -o forget_mult_cuda_kernel.cuda.o
E /bin/sh: 1: /usr/local/cuda/bin/nvcc: not found
E ninja: build stopped: subcommand failed.
!!! Interrupted: 1 errors during collection !!!
=========================== 1 error in 4.21 seconds ============================
Makefile:169: recipe for target ‘test’ failed
make: *** [test] Error 2``

anyone solved the error in recent version when running tests?

Exception: Error: libsixel is needed. See https://github.com/saitoha/libsixel

Issue logged here: https://github.com/fastai/fastai/issues/1798

wondering if there is a simple pip install to work around it until fixed

@PegasusWithoutWinds

you ran this command after pulling down the code?

and make an editable install with the developer prerequisites:

pip install -e ".[dev]"

https://docs.fast.ai/dev/git.html

Note, in the latest release, on testing there is an error - see my post above

I have got the same error.
Yes, using editable install and the latest code.
Error pops up when importing from fastai.tabular import *

Exception                                 Traceback (most recent call last)
<ipython-input-1-e6990e2f588f> in <module>
----> 1 from fastai.tabular import *
      2 from fastai.callbacks import ReduceLROnPlateauCallback,EarlyStoppingCallback
      3 from sklearn.metrics import roc_auc_score

~/fastai-fork/fastai/tabular/__init__.py in <module>
----> 1 from .. import basics
      2 from ..basics import *
      3 from .data import *
      4 from .transform import *
      5 from .models import *

~/fastai-fork/fastai/basics.py in <module>
----> 1 from .basic_train import *
      2 from .callback import *
      3 from .core import *
      4 from .basic_data import *
      5 from .data_block import *

~/fastai-fork/fastai/basic_train.py in <module>
      8 from fastprogress.fastprogress import format_time, IN_NOTEBOOK
      9 from time import time
---> 10 from fastai.sixel import plot_sixel
     11 
     12 __all__ = ['Learner', 'LearnerCallback', 'Recorder', 'RecordOnCPU', 'fit', 'loss_batch', 'train_epoch', 'validate',

~/fastai-fork/fastai/sixel.py in <module>
      3 libsixel = try_import('libsixel')
      4 if not libsixel:
----> 5     raise Exception('Error: `libsixel` is needed. See https://github.com/saitoha/libsixel')
      6 
      7 def _sixel_encode(data, width, height):

Exception: Error: `libsixel` is needed. See https://github.com/saitoha/libsixel
1 Like

I think I know who added the line :wink:

from fastai.sixel import plot_sixel

github has this nice blame function :wink:

libsixel was introduced by @jeremy in this commit.

1 Like

any pip installs found to work around it locally?

Think eventually its gonna go somewhere to the dependencies (maybe called by pip install -e “.[dev]”)

FIX: The error disapeared after I’ve installed libsixel-python using pip.

2 Likes

tried that, doesnt work in my case here locally

Did you manage to install libsixel-python?
Show me your error.

install is fine, error stays the same. no worries, can work around it :wink:

1 Like

Hey @Benudek, I just downgraded my local setup to the previous release. The package seems well maintained in Ubuntu but the brew maintenance has stopped years ago. I am personally using a Mac so my only option for now is to download the source files and compile them myself.

1 Like

I can confirm you that installing the package above did not solve my problem, either.