Repository: pykeen/pykeen
Issue: Evaluating Trained Model on CUDA
Root cause: Documentation Deficiency

I have trained a model on a remote server and now I am trying to evaluate the model by loading back the model.pkl file. Here is the sample code:
```python
tf_train = TriplesFactory.from_path(
    train_data_path,
    entity_to_id=ent_to_id,
    relation_to_id=rel_to_id)
tf_test = TriplesFactory.from_path(
    test_data_path,
    entity_to_id=ent_to_id,
    relation_to_id=rel_to_id)
tf_valid = TriplesFactory.from_path(
    val_data_path,
    entity_to_id=ent_to_id,
    relation_to_id=rel_to_id)
dev = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = torch.load("model/sheet_rotate_5/trained_model.pkl", map_location=dev)
evaluator = RankBasedEvaluator(filtered = True)
results = evaluator.evaluate(model, tf_test.mapped_triples, batch_size= 256, additional_filter_triples=[tf_train.mapped_triples), tf_valid.mapped_triples], device=dev)
```

This works fine when I am evaluating the model on CPU, but is extremely slow. When I am trying to evaluate on CUDA I am getting the below error:
`RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking arugment for argument tensors in method wrapper__cat)`
_(just realized there is an typo in error message, "arugment")_

I suppose the error is because of data not on CUDA. But I couldn't find any way to send TripleFactory to CUDA.
Any help is appreciated. Thank you!

### Environment

| Key             | Value                    |
|-----------------|--------------------------|
| OS              | posix                    |
| Platform        | Linux                    |
| Release         | 5.15.11-76051511-generic |
| User            | abhi8569                 |
| Time            | Mon Jan 24 21:57:22 2022 |
| Python          | 3.8.8                    |
| PyKEEN          | 1.5.0                    |
| PyKEEN Hash     | UNHASHED                 |
| PyKEEN Branch   |                          |
| PyTorch         | 1.9.0+cu111              |
| CUDA Available? | true                     |
| CUDA Version    | 11.1                     |
| cuDNN Version   | 8005                     |


### Issue Template Checks

- [X] This is not a bug report (use a different issue template if it is)
- [X] This is not a feature request (use a different issue template if it is)
- [X] I've read the text explaining why including environment information is important and understand if I omit this information that my issue will be dismissed

Hi @abhi8569 ,

does this help you? https://github.com/pykeen/pykeen/issues/727#issuecomment-1014592215

> 

Thanks, It worked!
May I know why specify .device when already stated the device in load function? I thought both do the same thing.

> > 
> 
> Thanks, It worked! May I know why specify .device when already stated the device in load function? I thought both do the same thing.

We store the device as an attribute inside the Model class, which essentially allows pykeen to infer the device as you did with
```python
torch.device("cuda" if torch.cuda.is_available() else "cpu")
```

However, we are not very happy with this, and there is some work on changing it, cf. https://github.com/pykeen/pykeen/pull/730