Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing default names for Phi2 and MistralAI #14338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ <h4 id="signature" class="signature">
process extensive textual input, expanding its utility in handling more complex tasks.</p><p>In summary, Mistral 7B represents a notable advancement in language models, offering a
reliable and versatile solution for various natural language processing challenges.</p><p>Pretrained models can be loaded with <code>pretrained</code> of the companion object:</p><pre><span class="kw">val</span> mistral = MistralTransformer.pretrained()
.setInputCols(<span class="lit">"document"</span>)
.setOutputCol(<span class="lit">"generation"</span>)</pre><p>The default model is <code>&quot;mistral-7b&quot;</code>, if no name is provided. For available pretrained models
.setOutputCol(<span class="lit">"generation"</span>)</pre><p>The default model is <code>&quot;mistral_7b&quot;</code>, if no name is provided. For available pretrained models
please see the <a href="https://sparknlp.org/models?q=mistral" target="_blank">Models Hub</a>.</p><p>For extended examples of usage, see
<a href="https://github.com/JohnSnowLabs/spark-nlp/blob/master/src/test/scala/com/johnsnowlabs/nlp/annotators/seq2seq/MistralTestSpec.scala" target="_blank">MistralTestSpec</a>.</p><p><b>References:</b></p><ul><li><a href="https://mistral.ai/news/announcing-mistral-7b/" target="_blank">Mistral 7B</a></li><li><a href="https://github.com/mistralai/mistral-src" target="_blank">https://github.com/mistralai/mistral-src</a></li></ul><p><b>Paper Abstract:</b></p><p><i>We introduce Mistral 7B v0.1, a 7-billion-parameter language model engineered for superior
<a href="https://github.com/JohnSnowLabs/spark-nlp/blob/master/src/test/scala/com/johnsnowlabs/nlp/annotators/seq2seq/MistralTestSpec.scala" target="_blank">MistralTestSpec</a>.</p><p><b>References:</b></p><ul><li><a href="https://mistral.ai/news/announcing-mistral_7b/" target="_blank">Mistral 7B</a></li><li><a href="https://github.com/mistralai/mistral-src" target="_blank">https://github.com/mistralai/mistral-src</a></li></ul><p><b>Paper Abstract:</b></p><p><i>We introduce Mistral 7B v0.1, a 7-billion-parameter language model engineered for superior
performance and efficiency. Mistral 7B outperforms Llama 2 13B across all evaluated
benchmarks, and Llama 1 34B in reasoning, mathematics, and code generation. Our model
leverages grouped-query attention (GQA) for faster inference, coupled with sliding window
Expand All @@ -305,7 +305,7 @@ <h4 id="signature" class="signature">
.setInputCol(<span class="lit">"text"</span>)
.setOutputCol(<span class="lit">"documents"</span>)

<span class="kw">val</span> mistral = MistralTransformer.pretrained(<span class="lit">"mistral-7b"</span>)
<span class="kw">val</span> mistral = MistralTransformer.pretrained(<span class="lit">"mistral_7b"</span>)
.setInputCols(<span class="std">Array</span>(<span class="lit">"documents"</span>))
.setMinOutputLength(<span class="num">10</span>)
.setMaxOutputLength(<span class="num">50</span>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ <h4 id="signature" class="signature">
.setInputCol(<span class="lit">"text"</span>)
.setOutputCol(<span class="lit">"documents"</span>)

<span class="kw">val</span> Phi2 = Phi2Transformer.pretrained(<span class="lit">"Phi2-7b"</span>)
<span class="kw">val</span> Phi2 = Phi2Transformer.pretrained(<span class="lit">"phi2_7b"</span>)
.setInputCols(<span class="std">Array</span>(<span class="lit">"documents"</span>))
.setMinOutputLength(<span class="num">10</span>)
.setMaxOutputLength(<span class="num">50</span>)
Expand Down
8 changes: 4 additions & 4 deletions docs/api/com/johnsnowlabs/nlp/annotators/seq2seq/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,9 @@ <h3>Type Members</h3>
process extensive textual input, expanding its utility in handling more complex tasks.</p><p>In summary, Mistral 7B represents a notable advancement in language models, offering a
reliable and versatile solution for various natural language processing challenges.</p><p>Pretrained models can be loaded with <code>pretrained</code> of the companion object:</p><pre><span class="kw">val</span> mistral = MistralTransformer.pretrained()
.setInputCols(<span class="lit">"document"</span>)
.setOutputCol(<span class="lit">"generation"</span>)</pre><p>The default model is <code>&quot;mistral-7b&quot;</code>, if no name is provided. For available pretrained models
.setOutputCol(<span class="lit">"generation"</span>)</pre><p>The default model is <code>&quot;mistral_7b&quot;</code>, if no name is provided. For available pretrained models
please see the <a href="https://sparknlp.org/models?q=mistral" target="_blank">Models Hub</a>.</p><p>For extended examples of usage, see
<a href="https://github.com/JohnSnowLabs/spark-nlp/blob/master/src/test/scala/com/johnsnowlabs/nlp/annotators/seq2seq/MistralTestSpec.scala" target="_blank">MistralTestSpec</a>.</p><p><b>References:</b></p><ul><li><a href="https://mistral.ai/news/announcing-mistral-7b/" target="_blank">Mistral 7B</a></li><li><a href="https://github.com/mistralai/mistral-src" target="_blank">https://github.com/mistralai/mistral-src</a></li></ul><p><b>Paper Abstract:</b></p><p><i>We introduce Mistral 7B v0.1, a 7-billion-parameter language model engineered for superior
<a href="https://github.com/JohnSnowLabs/spark-nlp/blob/master/src/test/scala/com/johnsnowlabs/nlp/annotators/seq2seq/MistralTestSpec.scala" target="_blank">MistralTestSpec</a>.</p><p><b>References:</b></p><ul><li><a href="https://mistral.ai/news/announcing-mistral_7b/" target="_blank">Mistral 7B</a></li><li><a href="https://github.com/mistralai/mistral-src" target="_blank">https://github.com/mistralai/mistral-src</a></li></ul><p><b>Paper Abstract:</b></p><p><i>We introduce Mistral 7B v0.1, a 7-billion-parameter language model engineered for superior
performance and efficiency. Mistral 7B outperforms Llama 2 13B across all evaluated
benchmarks, and Llama 1 34B in reasoning, mathematics, and code generation. Our model
leverages grouped-query attention (GQA) for faster inference, coupled with sliding window
Expand All @@ -1059,7 +1059,7 @@ <h3>Type Members</h3>
.setInputCol(<span class="lit">"text"</span>)
.setOutputCol(<span class="lit">"documents"</span>)

<span class="kw">val</span> mistral = MistralTransformer.pretrained(<span class="lit">"mistral-7b"</span>)
<span class="kw">val</span> mistral = MistralTransformer.pretrained(<span class="lit">"mistral_7b"</span>)
.setInputCols(<span class="std">Array</span>(<span class="lit">"documents"</span>))
.setMinOutputLength(<span class="num">10</span>)
.setMaxOutputLength(<span class="num">50</span>)
Expand Down Expand Up @@ -1134,7 +1134,7 @@ <h3>Type Members</h3>
.setInputCol(<span class="lit">"text"</span>)
.setOutputCol(<span class="lit">"documents"</span>)

<span class="kw">val</span> Phi2 = Phi2Transformer.pretrained(<span class="lit">"Phi2-7b"</span>)
<span class="kw">val</span> Phi2 = Phi2Transformer.pretrained(<span class="lit">"phi2_7b"</span>)
.setInputCols(<span class="std">Array</span>(<span class="lit">"documents"</span>))
.setMinOutputLength(<span class="num">10</span>)
.setMaxOutputLength(<span class="num">50</span>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ <h1>Source code for sparknlp.annotator.seq2seq.mistral_transformer</h1><div clas
<span class="sd"> ... .setOutputCol(&quot;generation&quot;)</span>


<span class="sd"> The default model is ``&quot;mistral-7b&quot;``, if no name is provided. For available</span>
<span class="sd"> The default model is ``&quot;mistral_7b&quot;``, if no name is provided. For available</span>
<span class="sd"> pretrained models please see the `Models Hub</span>
<span class="sd"> &lt;https://sparknlp.org/models?q=mistral&gt;`__.</span>

Expand Down Expand Up @@ -435,7 +435,7 @@ <h1>Source code for sparknlp.annotator.seq2seq.mistral_transformer</h1><div clas
<span class="sd"> References</span>
<span class="sd"> ----------</span>
<span class="sd"> - `Mistral 7B</span>
<span class="sd"> &lt;https://mistral.ai/news/announcing-mistral-7b/&gt;`__</span>
<span class="sd"> &lt;https://mistral.ai/news/announcing-mistral_7b/&gt;`__</span>
<span class="sd"> - https://github.com/mistralai/mistral-src</span>

<span class="sd"> **Paper Abstract:**</span>
Expand All @@ -458,7 +458,7 @@ <h1>Source code for sparknlp.annotator.seq2seq.mistral_transformer</h1><div clas
<span class="sd"> &gt;&gt;&gt; documentAssembler = DocumentAssembler() \\</span>
<span class="sd"> ... .setInputCol(&quot;text&quot;) \\</span>
<span class="sd"> ... .setOutputCol(&quot;documents&quot;)</span>
<span class="sd"> &gt;&gt;&gt; mistral = MistralTransformer.pretrained(&quot;mistral-7b&quot;) \\</span>
<span class="sd"> &gt;&gt;&gt; mistral = MistralTransformer.pretrained(&quot;mistral_7b&quot;) \\</span>
<span class="sd"> ... .setInputCols([&quot;documents&quot;]) \\</span>
<span class="sd"> ... .setMaxOutputLength(50) \\</span>
<span class="sd"> ... .setOutputCol(&quot;generation&quot;)</span>
Expand Down Expand Up @@ -670,13 +670,13 @@ <h1>Source code for sparknlp.annotator.seq2seq.mistral_transformer</h1><div clas
<span class="k">return</span> <span class="n">MistralTransformer</span><span class="p">(</span><span class="n">java_model</span><span class="o">=</span><span class="n">jModel</span><span class="p">)</span></div>

<span class="nd">@staticmethod</span>
<div class="viewcode-block" id="MistralTransformer.pretrained"><a class="viewcode-back" href="../../../../reference/autosummary/sparknlp/annotator/seq2seq/mistral_transformer/index.html#sparknlp.annotator.seq2seq.mistral_transformer.MistralTransformer.pretrained">[docs]</a> <span class="k">def</span> <span class="nf">pretrained</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;mistral-7b&quot;</span><span class="p">,</span> <span class="n">lang</span><span class="o">=</span><span class="s2">&quot;en&quot;</span><span class="p">,</span> <span class="n">remote_loc</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="MistralTransformer.pretrained"><a class="viewcode-back" href="../../../../reference/autosummary/sparknlp/annotator/seq2seq/mistral_transformer/index.html#sparknlp.annotator.seq2seq.mistral_transformer.MistralTransformer.pretrained">[docs]</a> <span class="k">def</span> <span class="nf">pretrained</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;mistral_7b&quot;</span><span class="p">,</span> <span class="n">lang</span><span class="o">=</span><span class="s2">&quot;en&quot;</span><span class="p">,</span> <span class="n">remote_loc</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Downloads and loads a pretrained model.</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> name : str, optional</span>
<span class="sd"> Name of the pretrained model, by default &quot;mistral-7b&quot;</span>
<span class="sd"> Name of the pretrained model, by default &quot;mistral_7b&quot;</span>
<span class="sd"> lang : str, optional</span>
<span class="sd"> Language of the pretrained model, by default &quot;en&quot;</span>
<span class="sd"> remote_loc : str, optional</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ <h1>Source code for sparknlp.annotator.seq2seq.phi2_transformer</h1><div class="
<span class="sd"> &gt;&gt;&gt; documentAssembler = DocumentAssembler() \\</span>
<span class="sd"> ... .setInputCol(&quot;text&quot;) \\</span>
<span class="sd"> ... .setOutputCol(&quot;documents&quot;)</span>
<span class="sd"> &gt;&gt;&gt; phi2 = Phi2Transformer.pretrained(&quot;phi2-7b&quot;) \\</span>
<span class="sd"> &gt;&gt;&gt; phi2 = Phi2Transformer.pretrained(&quot;phi2_7b&quot;) \\</span>
<span class="sd"> ... .setInputCols([&quot;documents&quot;]) \\</span>
<span class="sd"> ... .setMaxOutputLength(50) \\</span>
<span class="sd"> ... .setOutputCol(&quot;generation&quot;)</span>
Expand Down Expand Up @@ -647,13 +647,13 @@ <h1>Source code for sparknlp.annotator.seq2seq.phi2_transformer</h1><div class="
<span class="k">return</span> <span class="n">Phi2Transformer</span><span class="p">(</span><span class="n">java_model</span><span class="o">=</span><span class="n">jModel</span><span class="p">)</span></div>

<span class="nd">@staticmethod</span>
<div class="viewcode-block" id="Phi2Transformer.pretrained"><a class="viewcode-back" href="../../../../reference/autosummary/sparknlp/annotator/seq2seq/phi2_transformer/index.html#sparknlp.annotator.seq2seq.phi2_transformer.Phi2Transformer.pretrained">[docs]</a> <span class="k">def</span> <span class="nf">pretrained</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;phi2-7b&quot;</span><span class="p">,</span> <span class="n">lang</span><span class="o">=</span><span class="s2">&quot;en&quot;</span><span class="p">,</span> <span class="n">remote_loc</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="Phi2Transformer.pretrained"><a class="viewcode-back" href="../../../../reference/autosummary/sparknlp/annotator/seq2seq/phi2_transformer/index.html#sparknlp.annotator.seq2seq.phi2_transformer.Phi2Transformer.pretrained">[docs]</a> <span class="k">def</span> <span class="nf">pretrained</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;phi2_7b&quot;</span><span class="p">,</span> <span class="n">lang</span><span class="o">=</span><span class="s2">&quot;en&quot;</span><span class="p">,</span> <span class="n">remote_loc</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Downloads and loads a pretrained model.</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> name : str, optional</span>
<span class="sd"> Name of the pretrained model, by default &quot;phi2-7b&quot;</span>
<span class="sd"> Name of the pretrained model, by default &quot;phi2_7b&quot;</span>
<span class="sd"> lang : str, optional</span>
<span class="sd"> Language of the pretrained model, by default &quot;en&quot;</span>
<span class="sd"> remote_loc : str, optional</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ <h3>Classes<a class="headerlink" href="#classes" title="Permalink to this headin
<span class="gp">... </span> <span class="o">.</span><span class="n">setOutputCol</span><span class="p">(</span><span class="s2">&quot;generation&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>The default model is <code class="docutils literal notranslate"><span class="pre">&quot;mistral-7b&quot;</span></code>, if no name is provided. For available
<p>The default model is <code class="docutils literal notranslate"><span class="pre">&quot;mistral_7b&quot;</span></code>, if no name is provided. For available
pretrained models please see the <a class="reference external" href="https://sparknlp.org/models?q=mistral">Models Hub</a>.</p>
<table class="table">
<thead>
Expand Down Expand Up @@ -772,12 +772,12 @@ <h3>Classes<a class="headerlink" href="#classes" title="Permalink to this headin

<dl class="py method">
<dt class="sig sig-object py" id="sparknlp.annotator.seq2seq.mistral_transformer.MistralTransformer.pretrained">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">pretrained</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'mistral-7b'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lang</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'en'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">remote_loc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../../modules/sparknlp/annotator/seq2seq/mistral_transformer.html#MistralTransformer.pretrained"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sparknlp.annotator.seq2seq.mistral_transformer.MistralTransformer.pretrained" title="Permalink to this definition">#</a></dt>
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">pretrained</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'mistral_7b'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lang</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'en'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">remote_loc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../../modules/sparknlp/annotator/seq2seq/mistral_transformer.html#MistralTransformer.pretrained"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sparknlp.annotator.seq2seq.mistral_transformer.MistralTransformer.pretrained" title="Permalink to this definition">#</a></dt>
<dd><p>Downloads and loads a pretrained model.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>name</strong><span class="classifier">str, optional</span></dt><dd><p>Name of the pretrained model, by default “mistral-7b”</p>
<dt><strong>name</strong><span class="classifier">str, optional</span></dt><dd><p>Name of the pretrained model, by default “mistral_7b”</p>
</dd>
<dt><strong>lang</strong><span class="classifier">str, optional</span></dt><dd><p>Language of the pretrained model, by default “en”</p>
</dd>
Expand Down
Loading
Loading