Skip to content

Commit

Permalink
deploy: 2dfd318
Browse files Browse the repository at this point in the history
  • Loading branch information
yxdyc committed Aug 13, 2024
1 parent 77d908f commit 25470b0
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 50 deletions.
4 changes: 3 additions & 1 deletion _modules/data_juicer/ops/filter/image_aesthetics_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ <h1>Source code for data_juicer.ops.filter.image_aesthetics_filter</h1><div clas

<div class="viewcode-block" id="ImageAestheticsFilter.__init__"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageAestheticsFilter.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">hf_scorer_model</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">min_score</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">,</span>
<span class="n">max_score</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="n">any_or_all</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;any&#39;</span><span class="p">,</span>
Expand Down Expand Up @@ -153,7 +154,8 @@ <h1>Source code for data_juicer.ops.filter.image_aesthetics_filter</h1><div clas

<span class="bp">self</span><span class="o">.</span><span class="n">model_key</span> <span class="o">=</span> <span class="n">prepare_model</span><span class="p">(</span>
<span class="n">model_type</span><span class="o">=</span><span class="s1">&#39;simple_aesthetics&#39;</span><span class="p">,</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_scorer_model</span><span class="p">)</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_scorer_model</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="n">trust_remote_code</span><span class="p">)</span>
<span class="c1"># the original score predicted by laion-ai&#39;s scorer is within [0, 10]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">need_normalized_by_ten</span> <span class="o">=</span> <span class="p">(</span><span class="s1">&#39;shunk031/aesthetics-predictor&#39;</span>
<span class="ow">in</span> <span class="n">hf_scorer_model</span><span class="p">)</span></div>
Expand Down
4 changes: 3 additions & 1 deletion _modules/data_juicer/ops/filter/image_nsfw_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ <h1>Source code for data_juicer.ops.filter.image_nsfw_filter</h1><div class="hig

<div class="viewcode-block" id="ImageNSFWFilter.__init__"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageNSFWFilter.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">hf_nsfw_model</span><span class="o">=</span><span class="s1">&#39;Falconsai/nsfw_image_detection&#39;</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">score_threshold</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">,</span>
<span class="n">any_or_all</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;any&#39;</span><span class="p">,</span>
<span class="o">*</span><span class="n">args</span><span class="p">,</span>
Expand All @@ -138,7 +139,8 @@ <h1>Source code for data_juicer.ops.filter.image_nsfw_filter</h1><div class="hig
<span class="bp">self</span><span class="o">.</span><span class="n">any</span> <span class="o">=</span> <span class="p">(</span><span class="n">any_or_all</span> <span class="o">==</span> <span class="s1">&#39;any&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model_key</span> <span class="o">=</span> <span class="n">prepare_model</span><span class="p">(</span>
<span class="n">model_type</span><span class="o">=</span><span class="s1">&#39;huggingface&#39;</span><span class="p">,</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_nsfw_model</span><span class="p">)</span></div>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_nsfw_model</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="n">trust_remote_code</span><span class="p">)</span></div>

<div class="viewcode-block" id="ImageNSFWFilter.compute_stats"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageNSFWFilter.compute_stats">[docs]</a> <span class="k">def</span> <span class="nf">compute_stats</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="n">rank</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="c1"># check if it&#39;s computed already</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ <h1>Source code for data_juicer.ops.filter.image_text_matching_filter</h1><div c

<div class="viewcode-block" id="ImageTextMatchingFilter.__init__"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageTextMatchingFilter.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">hf_blip</span><span class="o">=</span><span class="s1">&#39;Salesforce/blip-itm-base-coco&#39;</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">min_score</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">0.003</span><span class="p">,</span>
<span class="n">max_score</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="n">horizontal_flip</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span>
Expand Down Expand Up @@ -155,7 +156,8 @@ <h1>Source code for data_juicer.ops.filter.image_text_matching_filter</h1><div c
<span class="sa">f</span><span class="s1">&#39;Can only be one of [&quot;any&quot;, &quot;all&quot;].&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">any</span> <span class="o">=</span> <span class="p">(</span><span class="n">any_or_all</span> <span class="o">==</span> <span class="s1">&#39;any&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model_key</span> <span class="o">=</span> <span class="n">prepare_model</span><span class="p">(</span><span class="n">model_type</span><span class="o">=</span><span class="s1">&#39;huggingface&#39;</span><span class="p">,</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_blip</span><span class="p">)</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_blip</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="n">trust_remote_code</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reduce_mode</span> <span class="o">=</span> <span class="n">reduce_mode</span>
<span class="bp">self</span><span class="o">.</span><span class="n">horizontal_flip</span> <span class="o">=</span> <span class="n">horizontal_flip</span>
<span class="bp">self</span><span class="o">.</span><span class="n">vertical_flip</span> <span class="o">=</span> <span class="n">vertical_flip</span></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ <h1>Source code for data_juicer.ops.filter.image_text_similarity_filter</h1><div

<div class="viewcode-block" id="ImageTextSimilarityFilter.__init__"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageTextSimilarityFilter.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">hf_clip</span><span class="o">=</span><span class="s1">&#39;openai/clip-vit-base-patch32&#39;</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">min_score</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">0.1</span><span class="p">,</span>
<span class="n">max_score</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="n">horizontal_flip</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span>
Expand Down Expand Up @@ -156,7 +157,8 @@ <h1>Source code for data_juicer.ops.filter.image_text_similarity_filter</h1><div
<span class="sa">f</span><span class="s1">&#39;Can only be one of [&quot;any&quot;, &quot;all&quot;].&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">any</span> <span class="o">=</span> <span class="p">(</span><span class="n">any_or_all</span> <span class="o">==</span> <span class="s1">&#39;any&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model_key</span> <span class="o">=</span> <span class="n">prepare_model</span><span class="p">(</span><span class="n">model_type</span><span class="o">=</span><span class="s1">&#39;huggingface&#39;</span><span class="p">,</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_clip</span><span class="p">)</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_clip</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="n">trust_remote_code</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reduce_mode</span> <span class="o">=</span> <span class="n">reduce_mode</span>
<span class="bp">self</span><span class="o">.</span><span class="n">horizontal_flip</span> <span class="o">=</span> <span class="n">horizontal_flip</span>
<span class="bp">self</span><span class="o">.</span><span class="n">vertical_flip</span> <span class="o">=</span> <span class="n">vertical_flip</span></div>
Expand Down
4 changes: 3 additions & 1 deletion _modules/data_juicer/ops/filter/image_watermark_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ <h1>Source code for data_juicer.ops.filter.image_watermark_filter</h1><div class

<div class="viewcode-block" id="ImageWatermarkFilter.__init__"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageWatermarkFilter.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">hf_watermark_model</span><span class="o">=</span><span class="s1">&#39;amrul-hzz/watermark_detector&#39;</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">prob_threshold</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">0.8</span><span class="p">,</span>
<span class="n">any_or_all</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;any&#39;</span><span class="p">,</span>
<span class="o">*</span><span class="n">args</span><span class="p">,</span>
Expand Down Expand Up @@ -142,7 +143,8 @@ <h1>Source code for data_juicer.ops.filter.image_watermark_filter</h1><div class
<span class="bp">self</span><span class="o">.</span><span class="n">any</span> <span class="o">=</span> <span class="p">(</span><span class="n">any_or_all</span> <span class="o">==</span> <span class="s1">&#39;any&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model_key</span> <span class="o">=</span> <span class="n">prepare_model</span><span class="p">(</span>
<span class="n">model_type</span><span class="o">=</span><span class="s1">&#39;huggingface&#39;</span><span class="p">,</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_watermark_model</span><span class="p">)</span></div>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_watermark_model</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="n">trust_remote_code</span><span class="p">)</span></div>

<div class="viewcode-block" id="ImageWatermarkFilter.compute_stats"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.ImageWatermarkFilter.compute_stats">[docs]</a> <span class="k">def</span> <span class="nf">compute_stats</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="n">rank</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="c1"># check if it&#39;s computed already</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ <h1>Source code for data_juicer.ops.filter.phrase_grounding_recall_filter</h1><d

<div class="viewcode-block" id="PhraseGroundingRecallFilter.__init__"><a class="viewcode-back" href="../../../../data_juicer.ops.filter.html#data_juicer.ops.filter.PhraseGroundingRecallFilter.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">hf_owlvit</span><span class="o">=</span><span class="s1">&#39;google/owlvit-base-patch32&#39;</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">min_recall</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">0.1</span><span class="p">,</span>
<span class="n">max_recall</span><span class="p">:</span> <span class="n">ClosedUnitInterval</span> <span class="o">=</span> <span class="mf">1.0</span><span class="p">,</span>
<span class="n">horizontal_flip</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span>
Expand Down Expand Up @@ -216,7 +217,8 @@ <h1>Source code for data_juicer.ops.filter.phrase_grounding_recall_filter</h1><d
<span class="sa">f</span><span class="s1">&#39;Can only be one of [&quot;any&quot;, &quot;all&quot;].&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">any</span> <span class="o">=</span> <span class="p">(</span><span class="n">any_or_all</span> <span class="o">==</span> <span class="s1">&#39;any&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model_key</span> <span class="o">=</span> <span class="n">prepare_model</span><span class="p">(</span><span class="n">model_type</span><span class="o">=</span><span class="s1">&#39;huggingface&#39;</span><span class="p">,</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_owlvit</span><span class="p">)</span>
<span class="n">pretrained_model_name_or_path</span><span class="o">=</span><span class="n">hf_owlvit</span><span class="p">,</span>
<span class="n">trust_remote_code</span><span class="o">=</span><span class="n">trust_remote_code</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reduce_mode</span> <span class="o">=</span> <span class="n">reduce_mode</span>
<span class="bp">self</span><span class="o">.</span><span class="n">horizontal_flip</span> <span class="o">=</span> <span class="n">horizontal_flip</span>
<span class="bp">self</span><span class="o">.</span><span class="n">vertical_flip</span> <span class="o">=</span> <span class="n">vertical_flip</span>
Expand Down
Loading

0 comments on commit 25470b0

Please sign in to comment.