Skip to content

Commit

Permalink
deploy: 12dfa82
Browse files Browse the repository at this point in the history
  • Loading branch information
Demirrr committed Dec 2, 2024
1 parent a926fcd commit 5c0fef4
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 167 deletions.
34 changes: 1 addition & 33 deletions _modules/dicee/executer.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,38 +157,6 @@ <h1>Source code for dicee.executer</h1><div class="highlight"><pre>
<span class="n">json</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">temp</span><span class="p">,</span> <span class="n">file_descriptor</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span></div>


<div class="viewcode-block" id="Execute.dept_read_preprocess_index_serialize_data">
<a class="viewcode-back" href="../../autoapi/dicee/index.html#dicee.executer.Execute.dept_read_preprocess_index_serialize_data">[docs]</a>
<span class="k">def</span> <span class="nf">dept_read_preprocess_index_serialize_data</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; Read &amp; Preprocess &amp; Index &amp; Serialize Input Data</span>

<span class="sd"> (1) Read or load the data from disk into memory.</span>
<span class="sd"> (2) Store the statistics of the data.</span>

<span class="sd"> Parameter</span>
<span class="sd"> ----------</span>

<span class="sd"> Return</span>
<span class="sd"> ----------</span>
<span class="sd"> None</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># (2) Store the stats and share parameters</span>
<span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">num_entities</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">num_entities</span>
<span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">num_relations</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">num_relations</span>
<span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">num_tokens</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">num_tokens</span>
<span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">max_length_subword_tokens</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">max_length_subword_tokens</span>
<span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">ordered_bpe_entities</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">ordered_bpe_entities</span>
<span class="bp">self</span><span class="o">.</span><span class="n">report</span><span class="p">[</span><span class="s1">&#39;num_train_triples&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">train_set</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">report</span><span class="p">[</span><span class="s1">&#39;num_entities&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">num_entities</span>
<span class="bp">self</span><span class="o">.</span><span class="n">report</span><span class="p">[</span><span class="s1">&#39;num_relations&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">num_relations</span>
<span class="bp">self</span><span class="o">.</span><span class="n">report</span><span class="p">[</span><span class="s1">&#39;num_relations&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">num_relations</span>
<span class="bp">self</span><span class="o">.</span><span class="n">report</span><span class="p">[</span>
<span class="s1">&#39;max_length_subword_tokens&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">max_length_subword_tokens</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">knowledge_graph</span><span class="o">.</span><span class="n">max_length_subword_tokens</span> <span class="k">else</span> <span class="kc">None</span>

<span class="bp">self</span><span class="o">.</span><span class="n">report</span><span class="p">[</span><span class="s1">&#39;runtime_kg_loading&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">start_time</span></div>


<div class="viewcode-block" id="Execute.save_trained_model">
<a class="viewcode-back" href="../../autoapi/dicee/index.html#dicee.executer.Execute.save_trained_model">[docs]</a>
<span class="nd">@timeit</span>
Expand Down Expand Up @@ -222,7 +190,7 @@ <h1>Source code for dicee.executer</h1><div class="highlight"><pre>
<span class="n">save_embeddings_as_csv</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">save_embeddings_as_csv</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">store</span><span class="p">(</span><span class="n">trained_model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">trained_model</span><span class="p">,</span>
<span class="n">model_name</span><span class="o">=</span><span class="s1">&#39;model_&#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()),</span>
<span class="n">model_name</span><span class="o">=</span><span class="s1">&#39;model&#39;</span><span class="p">,</span> <span class="c1"># + str(datetime.datetime.now()),</span>
<span class="n">full_storage_path</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">full_storage_path</span><span class="p">,</span>
<span class="n">save_embeddings_as_csv</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">save_embeddings_as_csv</span><span class="p">)</span>

Expand Down
3 changes: 1 addition & 2 deletions _modules/dicee/static_funcs.html
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,8 @@ <h1>Source code for dicee.static_funcs</h1><div class="highlight"><pre>
<span class="n">torch</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">state_dict</span><span class="p">(),</span> <span class="n">path</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">EnsembleKGE</span><span class="p">):</span>
<span class="c1"># path comes with ../model_...</span>
<span class="n">root_path</span><span class="o">=</span><span class="n">path</span><span class="p">[:</span><span class="n">rfind</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="s2">&quot;_&quot;</span><span class="p">)]</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">partial_model</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">model</span><span class="p">):</span>
<span class="n">new_path</span><span class="o">=</span><span class="n">root_path</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;model&quot;</span><span class="p">,</span><span class="sa">f</span><span class="s2">&quot;model_partial_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">.pt&quot;</span><span class="p">)</span>
<span class="n">new_path</span><span class="o">=</span><span class="n">path</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;model.pt&quot;</span><span class="p">,</span><span class="sa">f</span><span class="s2">&quot;model_partial_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">.pt&quot;</span><span class="p">)</span>
<span class="n">torch</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">partial_model</span><span class="o">.</span><span class="n">state_dict</span><span class="p">(),</span> <span class="n">new_path</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">torch</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">state_dict</span><span class="p">(),</span> <span class="n">path</span><span class="p">)</span></div>
Expand Down
14 changes: 0 additions & 14 deletions _sources/autoapi/dicee/executer/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,6 @@ Module Contents
.. py:method:: setup_executor() -> None
.. py:method:: dept_read_preprocess_index_serialize_data() -> None
Read & Preprocess & Index & Serialize Input Data

(1) Read or load the data from disk into memory.
(2) Store the statistics of the data.

Parameter
----------

:rtype: None



.. py:method:: save_trained_model() -> None
Save a knowledge graph embedding model
Expand Down
14 changes: 0 additions & 14 deletions _sources/autoapi/dicee/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2608,20 +2608,6 @@ Package Contents
.. py:method:: setup_executor() -> None
.. py:method:: dept_read_preprocess_index_serialize_data() -> None
Read & Preprocess & Index & Serialize Input Data

(1) Read or load the data from disk into memory.
(2) Store the statistics of the data.

Parameter
----------

:rtype: None



.. py:method:: save_trained_model() -> None
Save a knowledge graph embedding model
Expand Down
35 changes: 8 additions & 27 deletions autoapi/dicee/executer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.evaluator"><code class="docutils literal notranslate"><span class="pre">Execute.evaluator</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.start_time"><code class="docutils literal notranslate"><span class="pre">Execute.start_time</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.setup_executor"><code class="docutils literal notranslate"><span class="pre">Execute.setup_executor()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.dept_read_preprocess_index_serialize_data"><code class="docutils literal notranslate"><span class="pre">Execute.dept_read_preprocess_index_serialize_data()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.save_trained_model"><code class="docutils literal notranslate"><span class="pre">Execute.save_trained_model()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.end"><code class="docutils literal notranslate"><span class="pre">Execute.end()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#dicee.executer.Execute.write_report"><code class="docutils literal notranslate"><span class="pre">Execute.write_report()</span></code></a></li>
Expand Down Expand Up @@ -218,24 +217,6 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
<span class="sig-name descname"><span class="pre">setup_executor</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../../../_modules/dicee/executer.html#Execute.setup_executor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dicee.executer.Execute.setup_executor" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="dicee.executer.Execute.dept_read_preprocess_index_serialize_data">
<span class="sig-name descname"><span class="pre">dept_read_preprocess_index_serialize_data</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../../../_modules/dicee/executer.html#Execute.dept_read_preprocess_index_serialize_data"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dicee.executer.Execute.dept_read_preprocess_index_serialize_data" title="Link to this definition"></a></dt>
<dd><p>Read &amp; Preprocess &amp; Index &amp; Serialize Input Data</p>
<ol class="arabic simple">
<li><p>Read or load the data from disk into memory.</p></li>
<li><p>Store the statistics of the data.</p></li>
</ol>
<section id="parameter">
<h3>Parameter<a class="headerlink" href="#parameter" title="Link to this heading"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">rtype<span class="colon">:</span></dt>
<dd class="field-odd"><p>None</p>
</dd>
</dl>
</section>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="dicee.executer.Execute.save_trained_model">
<span class="sig-name descname"><span class="pre">save_trained_model</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../../../_modules/dicee/executer.html#Execute.save_trained_model"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dicee.executer.Execute.save_trained_model" title="Link to this definition"></a></dt>
Expand All @@ -246,8 +227,8 @@ <h3>Parameter<a class="headerlink" href="#parameter" title="Link to this heading
<li><p>Save the model into disk.</p></li>
<li><p>Update the stats of KG again ?</p></li>
</ol>
<section id="id1">
<h3>Parameter<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
<section id="parameter">
<h3>Parameter<a class="headerlink" href="#parameter" title="Link to this heading"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">rtype<span class="colon">:</span></dt>
<dd class="field-odd"><p>None</p>
Expand All @@ -265,8 +246,8 @@ <h3>Parameter<a class="headerlink" href="#id1" title="Link to this heading"><
<li><p>Report runtimes.</p></li>
<li><p>Eval model if required.</p></li>
</ol>
<section id="id2">
<h3>Parameter<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
<section id="id1">
<h3>Parameter<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">rtype<span class="colon">:</span></dt>
<dd class="field-odd"><p>A dict containing information about the training and/or evaluation</p>
Expand All @@ -289,8 +270,8 @@ <h3>Parameter<a class="headerlink" href="#id2" title="Link to this heading"><
# (2) Create an evaluator object.
# (3) Create a trainer object.
# (4) Start the training</p>
<section id="id3">
<h3>Parameter<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
<section id="id2">
<h3>Parameter<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">rtype<span class="colon">:</span></dt>
<dd class="field-odd"><p>A dict containing information about the training and/or evaluation</p>
Expand Down Expand Up @@ -323,8 +304,8 @@ <h3>Parameter<a class="headerlink" href="#id3" title="Link to this heading"><
<li><p>Start continual training.</p></li>
<li><p>Save trained model.</p></li>
</ol>
<section id="id4">
<h3>Parameter<a class="headerlink" href="#id4" title="Link to this heading"></a></h3>
<section id="id3">
<h3>Parameter<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">rtype<span class="colon">:</span></dt>
<dd class="field-odd"><p>A dict containing information about the training and/or evaluation</p>
Expand Down
Loading

0 comments on commit 5c0fef4

Please sign in to comment.