Skip to content

Commit

Permalink
danjust published a site update
Browse files Browse the repository at this point in the history
  • Loading branch information
danjust committed Oct 20, 2023
1 parent fad9f88 commit 0d2c633
Show file tree
Hide file tree
Showing 45 changed files with 734 additions and 734 deletions.
2 changes: 1 addition & 1 deletion _modules/besskge/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ <h1>Source code for besskge.utils</h1><div class="highlight"><pre>
<span class="sd"> Row-wise rotated tensors.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Always compute sin and cos in fp16, as faster on IPU</span>
<span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">dtype</span> <span class="o">==</span> <span class="n">torch</span><span class="o">.</span><span class="n">float32</span><span class="p">:</span>
<span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">dtype</span> <span class="o">==</span> <span class="n">torch</span><span class="o">.</span><span class="n">float32</span> <span class="ow">and</span> <span class="n">r</span><span class="o">.</span><span class="n">device</span><span class="o">.</span><span class="n">type</span> <span class="o">==</span> <span class="s2">&quot;ipu&quot;</span><span class="p">:</span>
<span class="n">r_cos</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">cos</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">float16</span><span class="p">))</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span>
<span class="n">r_sin</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">float16</span><span class="p">))</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand Down
38 changes: 19 additions & 19 deletions generated/besskge.batch_sampler.RandomShardedBatchSampler.html

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions generated/besskge.batch_sampler.RigidShardedBatchSampler.html

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions generated/besskge.batch_sampler.ShardedBatchSampler.html

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions generated/besskge.bess.BessKGE.html

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions generated/besskge.bess.EmbeddingMovingBessKGE.html

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions generated/besskge.bess.ScoreMovingBessKGE.html

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions generated/besskge.bess.TopKQueryBessKGE.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ <h1>besskge.bess.TopKQueryBessKGE<a class="headerlink" href="#besskge-bess-topkq
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>k</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – For each query return the top-k most likely predictions.</p></li>
<li><p><strong>candidate_sampler</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference internal" href="besskge.negative_sampler.TripleBasedShardedNegativeSampler.html#besskge.negative_sampler.TripleBasedShardedNegativeSampler" title="besskge.negative_sampler.TripleBasedShardedNegativeSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">TripleBasedShardedNegativeSampler</span></code></a>, <a class="reference internal" href="besskge.negative_sampler.PlaceholderNegativeSampler.html#besskge.negative_sampler.PlaceholderNegativeSampler" title="besskge.negative_sampler.PlaceholderNegativeSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">PlaceholderNegativeSampler</span></code></a>]) – Sampler of candidate entities to score against queries.
<li><p><strong>k</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – For each query return the top-k most likely predictions.</p></li>
<li><p><strong>candidate_sampler</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Union" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code></a>[<a class="reference internal" href="besskge.negative_sampler.TripleBasedShardedNegativeSampler.html#besskge.negative_sampler.TripleBasedShardedNegativeSampler" title="besskge.negative_sampler.TripleBasedShardedNegativeSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">TripleBasedShardedNegativeSampler</span></code></a>, <a class="reference internal" href="besskge.negative_sampler.PlaceholderNegativeSampler.html#besskge.negative_sampler.PlaceholderNegativeSampler" title="besskge.negative_sampler.PlaceholderNegativeSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">PlaceholderNegativeSampler</span></code></a>]) – Sampler of candidate entities to score against queries.
Use <a class="reference internal" href="besskge.negative_sampler.PlaceholderNegativeSampler.html#besskge.negative_sampler.PlaceholderNegativeSampler" title="besskge.negative_sampler.PlaceholderNegativeSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">besskge.negative_sampler.PlaceholderNegativeSampler</span></code></a>
to score queries against all entities in the knowledge graph, avoiding
unnecessary loading of negative entities on device.</p></li>
<li><p><strong>score_fn</strong> (<a class="reference internal" href="besskge.scoring.BaseScoreFunction.html#besskge.scoring.BaseScoreFunction" title="besskge.scoring.BaseScoreFunction"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseScoreFunction</span></code></a>) – Scoring function.</p></li>
<li><p><strong>evaluation</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference internal" href="besskge.metric.Evaluation.html#besskge.metric.Evaluation" title="besskge.metric.Evaluation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Evaluation</span></code></a>]) – Evaluation module, for computing metrics on device.
<li><p><strong>evaluation</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference internal" href="besskge.metric.Evaluation.html#besskge.metric.Evaluation" title="besskge.metric.Evaluation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Evaluation</span></code></a>]) – Evaluation module, for computing metrics on device.
Default: None.</p></li>
<li><p><strong>return_scores</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – If True, return scores of the top-k best completions.
<li><p><strong>return_scores</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – If True, return scores of the top-k best completions.
Default: False.</p></li>
<li><p><strong>window_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Size of the sliding window, namely the number of negative entities
<li><p><strong>window_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) – Size of the sliding window, namely the number of negative entities
scored against each query at each step of the on-device for-loop.
Should be decreased with large batch sizes, to avoid an OOM error.
Default: 100.</p></li>
Expand All @@ -149,22 +149,22 @@ <h1>besskge.bess.TopKQueryBessKGE<a class="headerlink" href="#besskge-bess-topkq
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>relation</strong> (<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>) – shape: (shard_bs,)
<li><p><strong>relation</strong> (<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>) – shape: (shard_bs,)
Relation indices.</p></li>
<li><p><strong>head</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (shard_bs,)
<li><p><strong>head</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (shard_bs,)
Head indices, if known. Default: None.</p></li>
<li><p><strong>tail</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (shard_bs,)
<li><p><strong>tail</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (shard_bs,)
Tail indices, if known. Default: None.</p></li>
<li><p><strong>negative</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (n_shard, B, padded_negative)
<li><p><strong>negative</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (n_shard, B, padded_negative)
Candidates to score against the queries.
It can be the same set for all queries (B=1),
or specific for each query in the batch (B=shard_bs).
If None, score each query against all entities in the knowledge
graph. Default: None.</p></li>
<li><p><strong>triple_mask</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (shard_bs,)
<li><p><strong>triple_mask</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (shard_bs,)
Mask to filter the triples in the micro-batch
before computing metrics. Default: None.</p></li>
<li><p><strong>negative_mask</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (n_shard, B, padded_negative)
<li><p><strong>negative_mask</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code></a>]) – shape: (n_shard, B, padded_negative)
If candidates are provided, mask to discard padding
negatives when computing best completions.
Requires the use of <code class="code docutils literal notranslate"><span class="pre">mask_on_gather=True</span></code> in the candidate
Expand All @@ -174,7 +174,7 @@ <h1>besskge.bess.TopKQueryBessKGE<a class="headerlink" href="#besskge-bess-topkq
</ul>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]</p>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Dict" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.12)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code></a>]</p>
</dd>
</dl>
</dd></dl>
Expand Down
Loading

0 comments on commit 0d2c633

Please sign in to comment.