Repository: pykeen/pykeen
Issue: ValueError: Cannot continue_training without being trained once.
GitHub labels: bug

**Describe the bug**
[I got a ``ValueError: Cannot continue_training without being trained once`` when I tried to continue training my KGE model.]

**To Reproduce**
Here are my codes: 
```python
from pykeen.triples import TriplesFactory
from pykeen.models import ComplEx
from torch.optim import Adam
from pykeen.training import LCWATrainingLoop,SLCWATrainingLoop
from pykeen.stoppers import EarlyStopper

tf = TriplesFactory(path='data.tsv')
training, testing = tf.split([.9,.1])
model = ComplEx(triples_factory=training)
optimizer = Adam(params=model.get_grad_params())

training_loop = LCWATrainingLoop(model=model, optimizer=optimizer)
```
Error 
```python-console
>>> training_loop.train(num_epochs=20,use_tqdm_batch=False)
Grouping triples: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 150k/150k [00:00<00:00, 513ktriple/s]
INFO:pykeen.training.training_loop:Starting batch_size search for training now...
INFO:pykeen.training.training_loop:Concluded batch_size search with batch_size=32.
Training epochs on cuda: 100%|█████████████████████████████████████████████████| 20/20 [1:07:26<00:00, 202.33s/epoch, loss=0.000378, prev_loss=0.000402]
[0.23125625108772244, 0.23452339748816786, 0.23559908256748388, 0.24065895721789968, 0.10477113186163411, 0.04466417128707494, 0.023899089869873838, 0.012131634176068901, 0.00530567248006516, 0.0023378641006335135, 0.001241895386934507, 0.0008487953254140871, 0.0006973548238468022, 0.0006295333710807524, 0.000591420917120261, 0.0005630363111860628, 0.0005367381855970944, 0.0005100692340512617, 0.0004826014208450764, 0.0004549426462575166, 0.0004278953073061021, 0.00040215552824730784, 0.00037816111185618053]
>>> training_loop.train(num_epochs=20,use_tqdm_batch=False,continue_training=True)
Grouping triples: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 150k/150k [00:00<00:00, 778ktriple/s]
INFO:pykeen.training.training_loop:Starting batch_size search for training now...
INFO:pykeen.training.training_loop:Concluded batch_size search with batch_size=32.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/hadmap-big/nicoleqye/kge/lib/python3.7/site-packages/pykeen/training/training_loop.py", line 196, in train
    num_workers=num_workers,
  File "/data/hadmap-big/nicoleqye/kge/lib/python3.7/site-packages/pykeen/training/training_loop.py", line 300, in _train
    raise ValueError('Cannot continue_training without being trained once.')
ValueError: Cannot continue_training without being trained once.
```

**Expected behavior**
Can I fix this error?

**Environment (please complete the following information):**
 - OS: [Linux]
 - Python version: [e.g. 3.7]
 - Version of this software: [pykeen 1.0.5] 


Hi @yeqing97 ,
Thanks for reporting this bug.

I have looked into it and the reason for the error is that you have to set the `batch_size` parameter of the training loop when you want to continue training. We will soon release a fix for this bug. For now you can already get going by changing your code above to:
```python
from pykeen.triples import TriplesFactory
from pykeen.models import ComplEx
from torch.optim import Adam
from pykeen.training import LCWATrainingLoop, SLCWATrainingLoop
from pykeen.stoppers import EarlyStopper

tf = TriplesFactory(path='data.tsv')
training, testing = tf.split([.9, .1])
model = ComplEx(triples_factory=training)
optimizer = Adam(params=model.get_grad_params())

training_loop = LCWATrainingLoop(model=model, optimizer=optimizer)
training_loop.train(batch_size=32, num_epochs=20, use_tqdm_batch=False)
training_loop.train(batch_size=32, num_epochs=20, use_tqdm_batch=False, continue_training=True)
```

Hi! @lvermue 
Thanks for your help!
However, this solution didn't work in my machine. 😭
The version of the pykeen, torch, cuda is '1.0.5', '1.4.0' and '10.0' respectively. 
Here are my error message:
```python-console
>>> training_loop.train(batch_size=32, num_epochs=2, use_tqdm_batch=False)
Grouping triples: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 150k/150k [00:00<00:00, 738ktriple/s]
Training epochs on cuda: 100%|█████████████████████████████████████████████████████████████| 2/2 [06:33<00:00, 197.00s/epoch, loss=0.103, prev_loss=nan]
[0.23592616682073322, 0.10322321332044633]
>>> training_loop.train(batch_size=32, num_epochs=2, use_tqdm_batch=False, continue_training=True)
Grouping triples: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 150k/150k [00:00<00:00, 752ktriple/s]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/hadmap-big/nicoleqye/kge/lib/python3.7/site-packages/pykeen/training/training_loop.py", line 196, in train
    num_workers=num_workers,
  File "/data/hadmap-big/nicoleqye/kge/lib/python3.7/site-packages/pykeen/training/training_loop.py", line 300, in _train
    raise ValueError('Cannot continue_training without being trained once.')
ValueError: Cannot continue_training without being trained once.
```


@yeqing97 
Sorry for the inconvenience, in the current master it's fixed already.
Given that it's PyKEEN 1.0.5, you also have to deactivate automatic memory optimization explicitly.

This code should work for you 😊
```python
from pykeen.triples import TriplesFactory
from pykeen.models import ComplEx
from torch.optim import Adam
from pykeen.training import LCWATrainingLoop, SLCWATrainingLoop
from pykeen.stoppers import EarlyStopper

tf = TriplesFactory(path='data.tsv')
training, testing = tf.split([.9, .1])
model = ComplEx(triples_factory=training, automatic_memory_optimization=False)
optimizer = Adam(params=model.get_grad_params())

training_loop = LCWATrainingLoop(model=model, optimizer=optimizer)
training_loop.train(batch_size=32, num_epochs=20, use_tqdm_batch=False)
training_loop.train(batch_size=32, num_epochs=20, use_tqdm_batch=False, continue_training=True)
```

Cool!
Thanks! It worked well! 👍

@yeqing97 glad to hear things have worked out! I'm going to close this issue, but feel free to open another one if you've got more questions :)