zhiminy/EvalEng huggingface dataset:
Repository: pykeen/pykeen
Issue: On Colab, error when importing from `pykeen.datasets.ogb`
Root cause: Environment Incompatibility

### Describe the bug

After installing PyKeen using Google Colab, when trying to run the code:
"from pykeen.pipeline import pipeline"
I get the following error:
```python-traceback
[/usr/local/lib/python3.7/dist-packages/pykeen/datasets/__init__.py](https://localhost:8080/#) in <module>()
     41 from .literal_base import NumericPathDataset
     42 from .nations import Nations
---> 43 from .ogb import OGBBioKG, OGBLoader, OGBWikiKG2
     44 from .openbiolink import OpenBioLink, OpenBioLinkLQ
     45 from .openea import OpenEA

ImportError: cannot import name 'OGBWikiKG2' from 'pykeen.datasets.ogb' (/usr/local/lib/python3.7/dist-packages/pykeen/datasets/ogb.py)
```

### How to reproduce

```python
! pip install git+https://github.com/pykeen/pykeen.git -q
from pykeen.triples import TriplesFactory
from pykeen.pipeline import pipeline
from pykeen.datasets.nations import NATIONS_TRAIN_PATH, NATIONS_TEST_PATH
```

### Environment

1.7.0

### Additional information

_No response_

I just fired up a new notebook and ran

```
! pip install git+https://github.com/pykeen/pykeen.git -q
from pykeen.triples import TriplesFactory
from pykeen.pipeline import pipeline
from pykeen.datasets.nations import NATIONS_TRAIN_PATH, NATIONS_TEST_PATH
print(NATIONS_TRAIN_PATH)
``` 

and got the expected path printed out, so this is probably an issue with the way your colab environment is set up. I'd suggest pinning the commit hash in the version of PyKEEN you're installing. Note we're also planning on the 1.8.0 release as soon as we finish up #835

1.8 is already out, since there wasn't any more feedback I'm going to close this
Repository: pykeen/pykeen
Issue: Small typos in docs
GitHub labels: bug

### Describe the bug

In the Pykeen documentation, in the [First Steps](https://pykeen.readthedocs.io/en/stable/tutorial/first_steps.html) section there is a call to the method 

https://github.com/pykeen/pykeen/blob/205af6c2604b3882bf0adf275610bceb6ac53c0c/docs/source/tutorial/first_steps.rst#L43

The method name is actually `entities_to_ids`

### How to reproduce

-

### Environment

-

### Additional information

_No response_

Thanks for pointing this out! Would you be interested in submitting a PR to fix this?

> 

Do you want me to create  a whole new branch for this and then merge it?

Yup, typically for a PR you create a fork, make a branch in it, then issue a pull request from your branch.

You can even use the GitHub interface to directly edit a file which takes care of the forking, branching, and then generation of the PR for you by starting at this link: https://github.com/pykeen/pykeen/edit/master/docs/source/tutorial/first_steps.rst
Repository: pykeen/pykeen
Issue: Support only BCEAfterSigmoidLoss and BCEWithLogits but not BCELoss
Root cause: Architectural Constraint

Currently, we support `BCE` and `BCEAfterSigmoidLoss`. However, training will fail when training a model with `BCE` because we do not provide the option `predict_with_sigmoid` in the `scort_hrt/h/r/t()` functions (we only support it in the `predict_scores_all_heads/tails/relations()` functions) .

We could remove the support for blank `BCE`, or we need to add the option `predict_with_sigmoid` in the scoring functions.

`BCE` should be [`BCEWithLogits`](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html)

You can either use `BCEAfterSigmoidLoss` **or** `BCEWithLogits`.

Closed b #109
Repository: pykeen/pykeen
Issue: Pipeline: Unable to change dimensions of embedding in instance of RotatE model 
Root cause: External Dependency Breakage

### Describe the bug

The RotatE model allows for the dimensions of entity and relationship representations to be passed as a model parameter `embedding_dim`, and the pipeline function allows the passing of model parameters using `model_kwargs`.

Using the following code segment (nb: epochs set to 1 just to demonstrate the bug):

```python
results = pipeline(
    training=self.training,
    testing=self.testing,
    validation=self.validation,
    model='RotatE', 
    stopper='early',
    epochs=1,
    model_kwargs = dict(embedding_dim=100,),
    random_seed=111,
)
```

The embeddings that are accessible through `results.model.entity_representations[0]` are showing embedding objects with `embedding_dim=200`, which is the default value of the RotatE model.

I have also tried using the pipeline parameter `dimensions=100`, but this has the same effect. 

### How to reproduce

Code sample included in the bug description

### Environment

Unable to handle parameter in AutoSF: coefficients
| Key             | Value                    |
|-----------------|--------------------------|
| OS              | nt                       |
| Platform        | Windows                  |
| Release         | 10                       |
| Time            | Wed Apr 20 14:54:12 2022 |
| Python          | 3.9.7                    |
| PyKEEN          | 1.7.0                    |
| PyKEEN Hash     | UNHASHED                 |
| PyKEEN Branch   |                          |
| PyTorch         | 1.10.1                   |
| CUDA Available? | true                     |
| CUDA Version    | 11.3                     |
| cuDNN Version   | 8200                     |

### Additional information

_No response_

@cosmiccreepers could you please update to the newest version of PyKEEN (v1.8.1) and see if this issue persists?

Hi @cosmiccreepers ,

on the current `master` (and thus with `pykeen==1.8.1`), I cannot reproduce the erratic behaviour. The following MWE works fine
```python
from pykeen.pipeline import pipeline

embedding_dim = 16
r = pipeline(
    dataset="nations",
    model="rotate",
    model_kwargs=dict(
        embedding_dim=16,
    ),
    training_kwargs=dict(num_epochs=0),
)
assert r.model.entity_representations[0].shape == (embedding_dim,)
```

I think it's also worth noting that RotatE uses complex embeddings, so the dimension of the embedding object is 2x what you put in - these can be converted into proper complex floating point numbers in several ways (maybe we need some docs for this though e.g., to piggy back on #877)

Updating to `pykeen==1.8.1` appears to have resolved it.

Thank you! :)
Repository: pykeen/pykeen
Issue: Pykeen 1.7.0 version loading fail.
Root cause: External Dependency Breakage

### Describe the bug

When I tried to ``` from pykeen.pipeline import pipeline ``` or ``` python -m pykeen version``` on version 1.7.0, these bug appear.
```
Traceback (most recent call last):
  File "/mnt/lun1/home/fxy/pykeen/RotatE_yago.py", line 4, in <module>
    from pykeen.pipeline import pipeline
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/pipeline/__init__.py", line 5, in <module>
    from .api import (
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/pipeline/api.py", line 205, in <module>
    from ..evaluation import Evaluator, MetricResults, evaluator_resolver
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/evaluation/__init__.py", line 10, in <module>
    from .classification_evaluator import ClassificationEvaluator, ClassificationMetricResults
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/evaluation/classification_evaluator.py", line 12, in <module>
    from .evaluator import Evaluator, MetricResults
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/evaluation/evaluator.py", line 20, in <module>
    from ..models import Model
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/models/__init__.py", line 17, in <module>
    from .unimodal import (
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/models/unimodal/__init__.py", line 100, in <module>
    from .rgcn import RGCN
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/models/unimodal/rgcn.py", line 13, in <module>
    from ...nn.message_passing import Decomposition, RGCNRepresentations
  File "/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/pykeen/nn/message_passing.py", line 11, in <module>
    from class_resolver.api import Hint
ImportError: cannot import name 'Hint' from 'class_resolver.api' (/home/fxy/miniconda3/envs/pykeen17/lib/python3.9/site-packages/class_resolver/api.py)
```


### How to reproduce

I  install it from source code or ```pip install pykeen==1.7.0```. 

### Environment

load fail.

### Additional information

I also found pykeen==1.8.1 ```RotatE``` model  results are significantly lower than 1.7.0 or 1.6.0,(such as hit@k)Maybe you can find out what happened.

@lovefxyo thanks for your interest, but we're not going to provide fixes for old versions of PyKEEN, so if you want to chat about evaluation results changing, it would be better to open a new issue.
Repository: pykeen/pykeen
Issue: PipelineResult.save_to_directory's log call fails for relative pathlib.Path
Root cause: Validation Gap

### Describe the bug

When passing a relative `pathlib.Path` to `PipelineResult.save_to_directory`, the logging message fails as it tries to convert the relative path to an URI. 
```python-traceback
Traceback (most recent call last):
  File "./scratch/relative_path.py", line 5, in <module>
    result.save_to_directory(pathlib.Path("results"))
  File "./src/pykeen/pipeline/api.py", line 396, in save_to_directory
    logger.info(f"Saved to directory: {directory.as_uri()}")
  File "/usr/lib/python3.8/pathlib.py", line 748, in as_uri
    raise ValueError("relative path can't be expressed as a file URI")
ValueError: relative path can't be expressed as a file URI
```
The results are still saved prior to this error.

### How to reproduce

```python
import pathlib
from pykeen.pipeline import pipeline

result = pipeline(dataset="nations", model="distmult")
result.save_to_directory(pathlib.Path("results"))
```

### Environment

| Key             | Value                    |
|-----------------|--------------------------|
| OS              | posix                    |
| Platform        | Linux                    |
| Release         | 5.4.0-105-generic        |
| Time            | Tue Apr 26 11:03:51 2022 |
| Python          | 3.8.10                   |
| PyKEEN          | 1.8.2-dev                |
| PyKEEN Hash     | f4d0f319                 |
| PyKEEN Branch   | master                   |
| PyTorch         | 1.10.2+cpu               |
| CUDA Available? | false                    |
| CUDA Version    | N/A                      |
| cuDNN Version   | N/A                      |

### Additional information

Found while trying to investigate https://github.com/pykeen/pykeen/issues/885

solution might be to call path.resolve() somewhere

It seems to be done already if we pass a string.
Repository: pykeen/pykeen
Issue: Scipy version needs to be >=1.7
Root cause: External Dependency Breakage

### Describe the bug

Using PyKEEN with scipy < 1.7 leads to bugs, but the setup.cfg specifies the required scipy version as >= 1.5.

### How to reproduce

Inside virtualenv:
```
python -m pip install scipy==1.6
python -m pip install pykeen
# make sure it's actually the right version
python -c "import scipy;print(scipy.version.version)"
# now the fun part
python -c "from pykeen.metrics.ranking import GeometricMeanRank;import numpy as np;generator=np.random.default_rng();print(GeometricMeanRank()(generator.random(size=(10,)),weights=generator.random(size=(10,))))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pykeen_env/lib/python3.9/site-packages/pykeen/metrics/ranking.py", line 946, in __call__
    return stats.gmean(ranks, weights=weights).item()
TypeError: gmean() got an unexpected keyword argument 'weights'
```

But there is no error after upgrading scipy:

```
python -m pip install scipy==1.7
python -c "from pykeen.metrics.ranking import GeometricMeanRank;import numpy as np;generator=np.random.default_rng();print(GeometricMeanRank()(generator.random(size=(10,)),weights=generator.random(size=(10,))))"
0.1593608361700785
```

### Environment

| Key             | Value                    |
|-----------------|--------------------------|
| OS              | posix                    |
| Platform        | Linux                    |
| Release         | 5.16.0-4-amd64           |
| Time            | Tue Apr 26 11:39:03 2022 |
| Python          | 3.9.9                    |
| PyKEEN          | 1.8.1                    |
| PyKEEN Hash     | UNHASHED                 |
| PyKEEN Branch   |                          |
| PyTorch         | 1.11.0+cu102             |
| CUDA Available? | false                    |
| CUDA Version    | 10.2                     |
| cuDNN Version   | 7605                     |

### Additional information

Changing the required version of scipy to >=1.7 should fix this.

Thanks for reporting the issue, @dobraczka ! 🙂
Repository: pykeen/pykeen
Issue: New init_phases doesn't work with NodePiece
Root cause: Interface Contract Mismatch

### Describe the bug

After #888 changed the `init_phases` function, I get the error while creating a standard documented NodePiece model

```
phases = 2 * np.pi * torch.rand_like(torch.view_as_complex(x).real)
RuntimeError: Tensor must have a last dimension of size 2
```

`x` here is the matrix of relations of shape `[num_relations, embedding_dim]`

### How to reproduce


```python
import torch
from pykeen.models import NodePiece
from pykeen.datasets import FB15k237

dataset = FB15k237(create_inverse_triples=True)

model = NodePiece(
    triples_factory=dataset.training,
    tokenizers=["AnchorTokenizer", "RelationTokenizer"],
    num_tokens=[20, 12],
    embedding_dim=64,
    interaction="rotate",
    relation_initializer="init_phases",
    relation_constrainer="complex_normalize",
    entity_initializer="xavier_uniform_",
)
```

### Environment

| Key             | Value                    |
|-----------------|--------------------------|
| OS              | posix                    |
| Platform        | Darwin                   |
| Release         | 21.2.0                   |
| Time            | Fri Apr 29 01:42:03 2022 |
| Python          | 3.8.5                    |
| PyKEEN          | 1.8.2-dev                |
| PyKEEN Hash     | 1394434f                 |
| PyKEEN Branch   | master                   |
| PyTorch         | 1.10.0                   |
| CUDA Available? | false                    |
| CUDA Version    | N/A                      |
| cuDNN Version   | N/A                      |

### Additional information

_No response_

This seems to be caused by the switch to `torch.cfloat`, and [torch's definition](https://pytorch.org/docs/stable/complex_numbers.html#transition-from-the-old-representation) of a the "real" format of complex numbers as having shape `(..., 2)`.

What we would need for (at least the init) to work, is to add `dtype=torch.cfloat` here
https://github.com/pykeen/pykeen/blob/1394434ff2c9f321d86654540ac0f497b2af504c/src/pykeen/models/unimodal/node_piece.py#L135-L144

I am not sure whether this will break other things, though 😅 

Smaller MWE:
```python
from pykeen.pipeline import pipeline

pipeline(
    dataset="nations",
    dataset_kwargs=dict(create_inverse_triples=True),
    model="nodepiece",
    model_kwargs=dict(
        tokenizers=["anchor", "relation"],
        num_tokens=[1, 2],
        embedding_dim=64,
        interaction="rotate",
        relation_initializer="init_phases",
        relation_constrainer="complex_normalize",
        entity_initializer="xavier_uniform_",
    ),
)
```
Repository: pykeen/pykeen
Issue: Bring Your Own Data Examples have a Typo
Root cause: Documentation Deficiency

**Describe the bug**

In the [Bring Your Own Data](https://pykeen.readthedocs.io/en/latest/tutorial/byod.html) section of the documentation, the results of a pipeline run are saved to the variable `pipeline_result`. Directly after `result.save_to_directory('test_pre_stratified_transe')` is called, triggering an error: `NameError: name 'result' is not defined`.

**To Reproduce**
Steps to reproduce the behavior:
1. Copy pasting the examples from [Bring Your Own Data](https://pykeen.readthedocs.io/en/latest/tutorial/byod.html) trigger a `NameError`.

**Expected behavior**

Rename `result` to `pipeline_result` (or vice versa) to prevent the `NameError` when copy pasting the example.

**Environment (please complete the following information):**
 
N/A. The issue is with the documentation.

**Additional information**

I looked for open or closed issues mentioning this typo and did not find them. Apologies if this typo is already known.


Thanks @JohnGiorgi for pointing this out!
We will fix the documentation.

Hi @JohnGiorgi, I remember we talked a while ago on your Saber repository. Thanks for the tip, will fix momentarily.
Repository: pykeen/pykeen
Issue: Get individual embeddings of an entity or relation
Root cause: Documentation Deficiency

### What is your question

Maybe a very silly question. I tried looking through the code and examples but couldn't find a way to get pure embeddings for a given entity. Is there a way to get embeddings for an entity or relation after the model has been trained?

### Environment

<html>
<body>
<!--StartFragment-->

Key | Value
-- | --
OS | posix
Platform | Linux
Release | 3.10.0-1160.53.1.el7.x86_64
Time | Tue May 3 11:46:37 2022
Python | 3.9.12
PyKEEN | 1.8.2-dev
PyKEEN Hash | UNHASHED
PyKEEN Branch |  
PyTorch | 1.11.0+cu102
CUDA Available? | false
CUDA Version | 10.2
cuDNN Version | 7605

<!--EndFragment-->
</body>
</html>

### 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 @alishiba14 ,

did you already see https://pykeen.readthedocs.io/en/stable/tutorial/first_steps.html#mapping-entity-and-relation-identifiers-to-their-names and https://pykeen.readthedocs.io/en/stable/tutorial/first_steps.html#using-learned-embeddings ? 

Thanks a lot! Found it now.
Repository: pykeen/pykeen
Issue: TypeError when loading WK3l15k, en-de
Root cause: Validation Gap

### Describe the bug

```python-traceback
Traceback (most recent call last):
  File "./scratch/ea.py", line 3, in <module>
    ds = WK3l15k(graph_pair="en_de", side=None)
  File "./src/pykeen/datasets/ea/wk3l.py", line 80, in __init__
    super().__init__(**kwargs)
  File "./src/pykeen/datasets/ea/base.py", line 64, in __init__
    left, right = [self._load_graph(side=side) for side in EA_SIDES]
  File "./src/pykeen/datasets/ea/base.py", line 64, in <listcomp>
    left, right = [self._load_graph(side=side) for side in EA_SIDES]
  File "./src/pykeen/datasets/ea/wk3l.py", line 112, in _load_graph
    return TriplesFactory.from_labeled_triples(
  File "./src/pykeen/triples/triples_factory.py", line 915, in from_labeled_triples
    entity_to_id = create_entity_mapping(triples=triples)
  File "./src/pykeen/triples/triples_factory.py", line 77, in create_entity_mapping
    entity_labels = sorted(set(heads).union(tails))
TypeError: '<' not supported between instances of 'str' and 'float'
```

### How to reproduce

```python
from pykeen.datasets import WK3l15k
ds = WK3l15k(graph_pair="en_de")
```

### Environment

| Key             | Value                    |
|-----------------|--------------------------|
| OS              | posix                    |
| Platform        | Linux                    |
| Release         | 5.4.0-72-generic         |
| Time            | Wed May  4 12:32:48 2022 |
| Python          | 3.8.10                   |
| PyKEEN          | 1.8.2-dev                |
| PyKEEN Hash     | c7762eca                 |
| PyKEEN Branch   | master                   |
| PyTorch         | 1.11.0+cpu               |
| CUDA Available? | false                    |
| CUDA Version    | N/A                      |
| cuDNN Version   | N/A                      |

### Additional information

It seems to be caused by `nan` values in
https://github.com/pykeen/pykeen/blob/c7762ecacdeb2b41b339251f96a43745743c871a/src/pykeen/datasets/ea/wk3l.py#L110

```python-console
>>> df["tail"].isna().any()
True
```

these originate from empty strings in the files
```
ajaccio@@@text@@@
```
Repository: pykeen/pykeen
Issue: Data format description
Root cause: External Dependency Breakage

I am having difficulty which format my KG data should be in to be used with pykeen. What is the structure that it should have ?


Hi @ChristopherMarais, the format is quite simple - you can have a TSV file with three columns corresponding to the head, relation, and tail. Each row should be a single triple. 

The tutorial at https://pykeen.readthedocs.io/en/latest/tutorial/byod.html should help you get started with using your own data. If you've got a specific uncertainty with this, I'd be glad to walk you through it and make any updates that will help you and other users! 

Happy Friday, greets from Germany

Hi thank you for the quick response. I managed to figure out the exact format by looking at the incorporated datasets. however I run into an error when using:

```python
tf = TriplesFactory(path=work_path + '/data.txt')
training, testing = tf.split()
```

I started a new issue with this error as the main topic, I'm not sure why it would give that error so I flagged it as a bug.

The error is the following:
---------------------------------------------------------------------------
```python-traceback
ValueError                                Traceback (most recent call last)
<ipython-input-15-ef15ccdc9011> in <module>
      3 
      4 tf = TriplesFactory(path=work_path + '/eucalyptus_triplets.txt')
----> 5 training, testing = tf.split()
      6 
      7 pipeline_result = pipeline(

~\anaconda3\envs\pykeen\lib\site-packages\pykeen\triples\triples_factory.py in split(self, ratios, random_state, randomize_cleanup)
    419         idx = np.arange(n_triples)
    420         if random_state is None:
--> 421             random_state = np.random.randint(0, 2 ** 32 - 1, dtype=np.int64)
    422             logger.warning(f'Using random_state={random_state} to split {self}')
    423         if isinstance(random_state, int):

mtrand.pyx in numpy.random.mtrand.RandomState.randint()

_bounded_integers.pyx in numpy.random._bounded_integers._rand_int32()

ValueError: high is out of bounds for int32
```

**Issue has been opened at:** #92 

P.s greetings from South Africa :)