muellerzr HF staff commited on
Commit
31cd561
1 Parent(s): 59a1f6a

With transformers and diffusers

Browse files
Files changed (5) hide show
  1. .gitignore +2 -0
  2. Accelerate.ipynb +21 -4
  3. _quarto.yml +0 -0
  4. index.html +16 -5
  5. slides.pdf +2 -2
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ /.quarto/
2
+ /.ipynb_checkpoints/
Accelerate.ipynb CHANGED
@@ -548,18 +548,35 @@
548
  },
549
  {
550
  "cell_type": "markdown",
551
- "id": "23911045-44a7-4e1d-aebc-db46be856234",
552
  "metadata": {},
553
  "source": [
554
- "## Demo!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  ]
556
  },
557
  {
558
  "cell_type": "markdown",
559
- "id": "6f5122b2-f4fe-4237-aff2-d2a69f85b692",
560
  "metadata": {},
561
  "source": [
562
- "# Thanks for Listening!"
 
 
563
  ]
564
  },
565
  {
 
548
  },
549
  {
550
  "cell_type": "markdown",
551
+ "id": "083c7037-27a2-4347-b473-358feb3316b3",
552
  "metadata": {},
553
  "source": [
554
+ "## Is there an easier way?\n",
555
+ "\n",
556
+ "The `transformers` library combined with the Hub makes all this code wrapping much easier for you with the `pipeline`\n",
557
+ "\n",
558
+ "```python\n",
559
+ "import torch\n",
560
+ "from transformers import pipeline\n",
561
+ "pipe = pipeline(\n",
562
+ " task=\"text-generation\",\n",
563
+ " model=\"EleutherAI/gpt-j-6B\",\n",
564
+ " device_map=\"auto\",\n",
565
+ " torch_dtype=torch.float16\n",
566
+ ")\n",
567
+ "\n",
568
+ "text = pipe(\"This is some generated text, I think\")\n",
569
+ "```"
570
  ]
571
  },
572
  {
573
  "cell_type": "markdown",
574
+ "id": "45b99a09-ba10-40b0-9b05-87360016da31",
575
  "metadata": {},
576
  "source": [
577
+ "# What about Stable Diffusion? \n",
578
+ "\n",
579
+ "A demo with `diffusers`"
580
  ]
581
  },
582
  {
_quarto.yml ADDED
File without changes
index.html CHANGED
@@ -706,13 +706,24 @@ Zachary Mueller
706
  <span id="cb18-11"><a href="#cb18-11"></a><span class="cf">for</span> batch <span class="kw">in</span> dataloader:</span>
707
  <span id="cb18-12"><a href="#cb18-12"></a> output <span class="op">=</span> my_model(batch)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
708
  </section>
709
- <section id="demo" class="slide level2">
710
- <h2>Demo!</h2>
 
 
 
 
 
 
 
 
 
 
 
711
  </section></section>
712
  <section>
713
- <section id="thanks-for-listening" class="title-slide slide level1 center">
714
- <h1>Thanks for Listening!</h1>
715
-
716
  </section>
717
  <section id="some-handy-resources" class="slide level2">
718
  <h2>Some Handy Resources</h2>
 
706
  <span id="cb18-11"><a href="#cb18-11"></a><span class="cf">for</span> batch <span class="kw">in</span> dataloader:</span>
707
  <span id="cb18-12"><a href="#cb18-12"></a> output <span class="op">=</span> my_model(batch)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
708
  </section>
709
+ <section id="is-there-an-easier-way" class="slide level2">
710
+ <h2>Is there an easier way?</h2>
711
+ <p>The <code>transformers</code> library combined with the Hub makes all this code wrapping much easier for you with the <code>pipeline</code></p>
712
+ <div class="sourceCode" id="cb19"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb19-1"><a href="#cb19-1"></a><span class="im">import</span> torch</span>
713
+ <span id="cb19-2"><a href="#cb19-2"></a><span class="im">from</span> transformers <span class="im">import</span> pipeline</span>
714
+ <span id="cb19-3"><a href="#cb19-3"></a>pipe <span class="op">=</span> pipeline(</span>
715
+ <span id="cb19-4"><a href="#cb19-4"></a> task<span class="op">=</span><span class="st">"text-generation"</span>,</span>
716
+ <span id="cb19-5"><a href="#cb19-5"></a> model<span class="op">=</span><span class="st">"EleutherAI/gpt-j-6B"</span>,</span>
717
+ <span id="cb19-6"><a href="#cb19-6"></a> device_map<span class="op">=</span><span class="st">"auto"</span>,</span>
718
+ <span id="cb19-7"><a href="#cb19-7"></a> torch_dtype<span class="op">=</span>torch.float16</span>
719
+ <span id="cb19-8"><a href="#cb19-8"></a>)</span>
720
+ <span id="cb19-9"><a href="#cb19-9"></a></span>
721
+ <span id="cb19-10"><a href="#cb19-10"></a>text <span class="op">=</span> pipe(<span class="st">"This is some generated text, I think"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
722
  </section></section>
723
  <section>
724
+ <section id="what-about-stable-diffusion" class="title-slide slide level1 center">
725
+ <h1>What about Stable Diffusion?</h1>
726
+ <p>A demo with <code>diffusers</code></p>
727
  </section>
728
  <section id="some-handy-resources" class="slide level2">
729
  <h2>Some Handy Resources</h2>
slides.pdf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9a3a0dbfe344498ca5085869f9227f6c65bcab61cc3ad2adcc1766b08598b7b5
3
- size 3727642
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a71ff5f7037f072c730b9e60dd70b6bec9c898116844e4f49cc12213a505f7c0
3
+ size 3886471