Skip to content

Commit

Permalink
deploy: 4c6535e
Browse files Browse the repository at this point in the history
  • Loading branch information
fjxmlzn committed Dec 20, 2024
1 parent 7d0bfe3 commit d2ca6b8
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 43 deletions.
6 changes: 3 additions & 3 deletions _modules/pe/api/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ <h1>Source code for pe.api.api</h1><div class="highlight"><pre>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;The abstract class that defines the APIs for the synthetic data generation.&quot;&quot;&quot;</span>

<div class="viewcode-block" id="API.random_api"><a class="viewcode-back" href="../../../api/pe.api.html#pe.api.api.API.random_api">[docs]</a> <span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">random_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_name</span><span class="p">,</span> <span class="n">num_samples</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">random_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_info</span><span class="p">,</span> <span class="n">num_samples</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;The abstract method that generates random synthetic data.</span>

<span class="sd"> :param label_name: The name of the label</span>
<span class="sd"> :type label_name: str</span>
<span class="sd"> :param label_info: The info of the label</span>
<span class="sd"> :type label_info: dict</span>
<span class="sd"> :param num_samples: The number of random samples to generate</span>
<span class="sd"> :type num_samples: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand Down
7 changes: 4 additions & 3 deletions _modules/pe/api/image/improved_diffusion_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,17 @@ <h1>Source code for pe.api.image.improved_diffusion_api</h1><div class="highligh
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_variation_degrees</span> <span class="o">=</span> <span class="n">variation_degrees</span></div>

<div class="viewcode-block" id="ImprovedDiffusion.random_api"><a class="viewcode-back" href="../../../../api/pe.api.image.html#pe.api.image.improved_diffusion_api.ImprovedDiffusion.random_api">[docs]</a> <span class="k">def</span> <span class="nf">random_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_name</span><span class="p">,</span> <span class="n">num_samples</span><span class="p">):</span>
<div class="viewcode-block" id="ImprovedDiffusion.random_api"><a class="viewcode-back" href="../../../../api/pe.api.image.html#pe.api.image.improved_diffusion_api.ImprovedDiffusion.random_api">[docs]</a> <span class="k">def</span> <span class="nf">random_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_info</span><span class="p">,</span> <span class="n">num_samples</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Generating random synthetic data.</span>

<span class="sd"> :param label_name: The name of the label, not utilized in this API</span>
<span class="sd"> :type label_name: str</span>
<span class="sd"> :param label_info: The info of the label, not utilized in this API</span>
<span class="sd"> :type label_info: dict</span>
<span class="sd"> :param num_samples: The number of random samples to generate</span>
<span class="sd"> :type num_samples: int</span>
<span class="sd"> :return: The data object of the generated synthetic data</span>
<span class="sd"> :rtype: :py:class:`pe.data.data.Data`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">label_name</span> <span class="o">=</span> <span class="n">label_info</span><span class="o">.</span><span class="n">name</span>
<span class="n">execution_logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;RANDOM API: creating </span><span class="si">{</span><span class="n">num_samples</span><span class="si">}</span><span class="s2"> samples for label </span><span class="si">{</span><span class="n">label_name</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">samples</span><span class="p">,</span> <span class="n">labels</span> <span class="o">=</span> <span class="n">sample</span><span class="p">(</span>
<span class="n">sampler</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_timestep_respacing_to_sampler</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_timestep_respacing</span><span class="p">[</span><span class="mi">0</span><span class="p">]],</span>
Expand Down
7 changes: 4 additions & 3 deletions _modules/pe/api/image/stable_diffusion_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,17 @@ <h1>Source code for pe.api.image.stable_diffusion_api</h1><div class="highlight"
<span class="bp">self</span><span class="o">.</span><span class="n">_variation_api_pipe</span><span class="o">.</span><span class="n">safety_checker</span> <span class="o">=</span> <span class="kc">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_variation_api_pipe</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_variation_api_pipe</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="p">)</span></div>

<div class="viewcode-block" id="StableDiffusion.random_api"><a class="viewcode-back" href="../../../../api/pe.api.image.html#pe.api.image.stable_diffusion_api.StableDiffusion.random_api">[docs]</a> <span class="k">def</span> <span class="nf">random_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_name</span><span class="p">,</span> <span class="n">num_samples</span><span class="p">):</span>
<div class="viewcode-block" id="StableDiffusion.random_api"><a class="viewcode-back" href="../../../../api/pe.api.image.html#pe.api.image.stable_diffusion_api.StableDiffusion.random_api">[docs]</a> <span class="k">def</span> <span class="nf">random_api</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_info</span><span class="p">,</span> <span class="n">num_samples</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Generating random synthetic data.</span>

<span class="sd"> :param label_name: The name of the label, not utilized in this API</span>
<span class="sd"> :type label_name: str</span>
<span class="sd"> :param label_info: The info of the label</span>
<span class="sd"> :type label_info: dict</span>
<span class="sd"> :param num_samples: The number of random samples to generate</span>
<span class="sd"> :type num_samples: int</span>
<span class="sd"> :return: The data object of the generated synthetic data</span>
<span class="sd"> :rtype: :py:class:`pe.data.data.Data`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">label_name</span> <span class="o">=</span> <span class="n">label_info</span><span class="o">.</span><span class="n">name</span>
<span class="n">execution_logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;RANDOM API: creating </span><span class="si">{</span><span class="n">num_samples</span><span class="si">}</span><span class="s2"> samples for label </span><span class="si">{</span><span class="n">label_name</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>

<span class="n">prompt</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prompt</span><span class="p">[</span><span class="n">label_name</span><span class="p">]</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/pe/callback/image/sample_images.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h1>Source code for pe.callback.image.sample_images</h1><div class="highlight"><
<span class="sd"> :rtype: list[:py:class:`pe.metric_item.ImageListMetricItem`]</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">all_image_list</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">num_classes</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">syn_data</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">label_names</span><span class="p">)</span>
<span class="n">num_classes</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">syn_data</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">label_info</span><span class="p">)</span>
<span class="k">for</span> <span class="n">class_id</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">num_classes</span><span class="p">):</span>
<span class="n">image_list</span> <span class="o">=</span> <span class="n">syn_data</span><span class="o">.</span><span class="n">data_frame</span><span class="p">[</span><span class="n">syn_data</span><span class="o">.</span><span class="n">data_frame</span><span class="p">[</span><span class="n">LABEL_ID_COLUMN_NAME</span><span class="p">]</span> <span class="o">==</span> <span class="n">class_id</span><span class="p">][</span>
<span class="n">IMAGE_DATA_COLUMN_NAME</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/pe/callback/image/save_all_images.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h1>Source code for pe.callback.image.save_all_images</h1><div class="highlight"
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">iterator</span><span class="p">:</span>
<span class="n">image</span> <span class="o">=</span> <span class="n">syn_data</span><span class="o">.</span><span class="n">data_frame</span><span class="p">[</span><span class="n">IMAGE_DATA_COLUMN_NAME</span><span class="p">][</span><span class="n">i</span><span class="p">]</span>
<span class="n">label_id</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">syn_data</span><span class="o">.</span><span class="n">data_frame</span><span class="p">[</span><span class="n">LABEL_ID_COLUMN_NAME</span><span class="p">][</span><span class="n">i</span><span class="p">])</span>
<span class="n">label_name</span> <span class="o">=</span> <span class="n">syn_data</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">label_names</span><span class="p">[</span><span class="n">label_id</span><span class="p">]</span>
<span class="n">label_name</span> <span class="o">=</span> <span class="n">syn_data</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">label_info</span><span class="p">[</span><span class="n">label_id</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">syn_data</span><span class="o">.</span><span class="n">data_frame</span><span class="o">.</span><span class="n">index</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_save_image</span><span class="p">(</span>
<span class="n">image</span><span class="o">=</span><span class="n">image</span><span class="p">,</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/pe/data/image/camelyon17.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h1>Source code for pe.data.image.camelyon17</h1><div class="highlight"><pre>
<span class="n">LABEL_ID_COLUMN_NAME</span><span class="p">:</span> <span class="n">labels</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_names&quot;</span><span class="p">:</span> <span class="n">CAMELYON17_LABEL_NAMES</span><span class="p">}</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_info&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="n">n</span><span class="p">}</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">CAMELYON17_LABEL_NAMES</span><span class="p">]}</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">data_frame</span><span class="o">=</span><span class="n">data_frame</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">)</span></div></div>
</pre></div>

Expand Down
2 changes: 1 addition & 1 deletion _modules/pe/data/image/cat.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h1>Source code for pe.data.image.cat</h1><div class="highlight"><pre>
<span class="n">LABEL_ID_COLUMN_NAME</span><span class="p">:</span> <span class="n">labels</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_names&quot;</span><span class="p">:</span> <span class="n">CAT_LABEL_NAMES</span><span class="p">}</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_info&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="n">n</span><span class="p">}</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">CAT_LABEL_NAMES</span><span class="p">]}</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">data_frame</span><span class="o">=</span><span class="n">data_frame</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">)</span></div>

<div class="viewcode-block" id="Cat._download"><a class="viewcode-back" href="../../../../api/pe.data.image.html#pe.data.image.cat.Cat._download">[docs]</a> <span class="k">def</span> <span class="nf">_download</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/pe/data/image/cifar10.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ <h1>Source code for pe.data.image.cifar10</h1><div class="highlight"><pre>
<span class="n">LABEL_ID_COLUMN_NAME</span><span class="p">:</span> <span class="n">dataset</span><span class="o">.</span><span class="n">targets</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_names&quot;</span><span class="p">:</span> <span class="n">CIFAR10_LABEL_NAMES</span><span class="p">}</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_info&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="n">n</span><span class="p">}</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">CIFAR10_LABEL_NAMES</span><span class="p">]}</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">data_frame</span><span class="o">=</span><span class="n">data_frame</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">)</span></div></div>
</pre></div>

Expand Down
2 changes: 1 addition & 1 deletion _modules/pe/data/image/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h1>Source code for pe.data.image.image</h1><div class="highlight"><pre>
<span class="n">LABEL_ID_COLUMN_NAME</span><span class="p">:</span> <span class="nb">list</span><span class="p">(</span><span class="n">all_labels</span><span class="p">),</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_names&quot;</span><span class="p">:</span> <span class="n">dataset</span><span class="o">.</span><span class="n">class_names</span> <span class="k">if</span> <span class="n">class_cond</span> <span class="k">else</span> <span class="p">[</span><span class="s2">&quot;None&quot;</span><span class="p">]}</span>
<span class="n">metadata</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;label_info&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="n">n</span><span class="p">}</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">dataset</span><span class="o">.</span><span class="n">class_names</span><span class="p">]</span> <span class="k">if</span> <span class="n">class_cond</span> <span class="k">else</span> <span class="p">[{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;None&quot;</span><span class="p">}]}</span>
<span class="k">return</span> <span class="n">Data</span><span class="p">(</span><span class="n">data_frame</span><span class="o">=</span><span class="n">data_frame</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="n">metadata</span><span class="p">)</span></div>
</pre></div>

Expand Down
Loading

0 comments on commit d2ca6b8

Please sign in to comment.