AttributeError: 'NoneType' object has no attribute 'split'
Author: laonb
Pull request: no

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-4393ada473d4> in <module>
      1 import torch
----> 2 from pytorch_transformers import *

~/anaconda3/envs/python/lib/python3.6/site-packages/pytorch_transformers/__init__.py in <module>
      8 from .tokenization_utils import (PreTrainedTokenizer, clean_up_tokenization)
      9 
---> 10 from .modeling_bert import (BertConfig, BertModel, BertForPreTraining,
     11                        BertForMaskedLM, BertForNextSentencePrediction,
     12                        BertForSequenceClassification, BertForMultipleChoice,

~/anaconda3/envs/python/lib/python3.6/site-packages/pytorch_transformers/modeling_bert.py in <module>
    222 
    223 try:
--> 224     from apex.normalization.fused_layer_norm import FusedLayerNorm as BertLayerNorm
    225 except ImportError:
    226     logger.info("Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex .")

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_backward_compatible(spec)

~/anaconda3/envs/python/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/__init__.py in <module>
      1 from . import parallel
----> 2 from . import amp
      3 from . import fp16_utils
      4 
      5 # For optimizers and normalization there is no Python fallback.

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_backward_compatible(spec)

~/anaconda3/envs/python/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/__init__.py in <module>
----> 1 from .amp import init, half_function, float_function, promote_function,\
      2     register_half_function, register_float_function, register_promote_function
      3 from .handle import scale_loss, disable_casts
      4 from .frontend import initialize
      5 from ._amp_state import master_params, _amp_state

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_backward_compatible(spec)

~/anaconda3/envs/python/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/amp.py in <module>
      1 from . import compat, rnn_compat, utils, wrap
      2 from .handle import AmpHandle, NoOpHandle
----> 3 from .lists import functional_overrides, torch_overrides, tensor_overrides
      4 from ._amp_state import _amp_state
      5 from .frontend import *

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)

~/anaconda3/envs/python/lib/python3.6/importlib/_bootstrap.py in _load_backward_compatible(spec)

~/anaconda3/envs/python/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/lists/torch_overrides.py in <module>
     67          'baddbmm',
     68          'bmm']
---> 69 if utils.get_cuda_version() >= (9, 1, 0):
     70     FP16_FUNCS.extend(_bmms)
     71 else:

~/anaconda3/envs/python/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/utils.py in get_cuda_version()
      7 
      8 def get_cuda_version():
----> 9     return tuple(int(x) for x in torch.version.cuda.split('.'))
     10 
     11 def is_fp_tensor(x):

AttributeError: 'NoneType' object has no attribute 'split'

Comments:
conda 4.5.12
Python 3.6.8 :: Anaconda, Inc.
torch 1.1.0

Is it possible you installed the CPU-only version of PyTorch? Which command did you use to install it? Did you do it via conda or pip?

Seems like a problem related to apex, you should open an issue on NVIDIA's repo.
I'm closing this one for now.