<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Juan Felipe Lujan</title>
    <description>The latest articles on DEV Community by Juan Felipe Lujan (@felipelujan).</description>
    <link>https://dev.to/felipelujan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F135774%2F18b44128-8fc2-493b-855a-0f4c944b1c04.jpeg</url>
      <title>DEV Community: Juan Felipe Lujan</title>
      <link>https://dev.to/felipelujan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felipelujan"/>
    <language>en</language>
    <item>
      <title>Running Nvidia COSMOS on A100 80Gb</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Mon, 13 Jan 2025 01:32:48 +0000</pubDate>
      <link>https://dev.to/felipelujan/running-nvidia-cosmos-on-a100-80gb-2ob9</link>
      <guid>https://dev.to/felipelujan/running-nvidia-cosmos-on-a100-80gb-2ob9</guid>
      <description>&lt;p&gt;Video Example&lt;br&gt;
&lt;a href="https://youtube.com/shorts/9dOihUzSSho" rel="noopener noreferrer"&gt;https://youtube.com/shorts/9dOihUzSSho&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to run Nvidia Cosmos on Ubuntu 22.04
&lt;/h2&gt;

&lt;p&gt;In this tutorial, you'll learn how to quickly set up Ubuntu 22.04 to run Nvidia Cosmos. This involves installing the necessary drivers, Docker, and CUDA dependencies.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks to the Google Developers Experts program for providing the infra for this experiment 🧪&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Prequisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Ubuntu 22.04 doh.&lt;/li&gt;
&lt;li&gt;A beefy Nvidia GPU. 30Gb+ of VRAM. Either Blackwell, Hopper, or Ampere.&lt;/li&gt;
&lt;li&gt;200Gb+ of local storage.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step1: Run Script 1
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o-&lt;/span&gt; https://raw.githubusercontent.com/FelipeLujan/GCPexperiments/refs/heads/master/NvidiaCosmos/prepare_ubuntu%20_part1.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Script 1 updates Ubuntu, installs Nvidia drivers, and reboots to finalize changes.&lt;/p&gt;
&lt;h2&gt;
  
  
  Script 2
&lt;/h2&gt;

&lt;p&gt;Run once your is back up.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o-&lt;/span&gt; https://raw.githubusercontent.com/FelipeLujan/GCPexperiments/refs/heads/master/NvidiaCosmos/prepare_ubuntu_part2.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Script 2 installs Docker, configures the Nvidia toolkit, then clones and builds the Cosmos repository.&lt;/p&gt;

&lt;p&gt;If you see something like this at the end of Script 2, congratulations, your docker container is almost ready to run Cosmos.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.216.03             Driver Version: 535.216.03   CUDA Version: 12.6     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A100-SXM4-80GB          Off | 00000000:00:05.0 Off |                    0 |
| N/A   32C    P0              57W / 400W |      0MiB / 81920MiB |     24%      Default |
|                                         |                      |             Disabled |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Downloading cosmos models in Docker Container.
&lt;/h2&gt;

&lt;p&gt;At this point, your command line is attached to the costmos_container docker, run  &lt;code&gt;huggingface-cli login&lt;/code&gt; and insert your Hugging Face Token. &lt;/p&gt;

&lt;p&gt;Generate it here &lt;a href="https://huggingface.co/settings/tokens" rel="noopener noreferrer"&gt;https://huggingface.co/settings/tokens&lt;/a&gt; you only need to Check &lt;em&gt;grant Read access to contents of all public gated repos you can access&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Download only the 7B Text2Video model by running this command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PYTHONPATH=$(pwd) python cosmos1/scripts/download_diffusion.py --model_sizes 7B 14B --model_types Text2World Video2World
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This download is over 50Gb. Give it a few minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate a video from a text prompt.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PROMPT="A sleek, humanoid robot stands in a vast warehouse filled with neatly stacked cardboard boxes on industrial shelves. \
The robot's metallic body gleams under the bright, even lighting, highlighting its futuristic design and intricate joints. \
A glowing blue light emanates from its chest, adding a touch of advanced technology. The background is dominated by rows of boxes, \
suggesting a highly organized storage system. The floor is lined with wooden pallets, enhancing the industrial setting. \
The camera remains static, capturing the robot's poised stance amidst the orderly environment, with a shallow depth of \
field that keeps the focus on the robot while subtly blurring the background for a cinematic effect."

# Example using 7B model
PYTHONPATH=$(pwd) python cosmos1/models/diffusion/inference/text2world.py \
    --checkpoint_dir checkpoints \
    --diffusion_transformer_dir Cosmos-1.0-Diffusion-7B-Text2World \
    --prompt "$PROMPT" \
    --offload_prompt_upsampler \
    --video_save_name Cosmos-1.0-Diffusion-7B-Text2World

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>nvidia</category>
      <category>cuda</category>
      <category>ai</category>
      <category>text2video</category>
    </item>
    <item>
      <title>Ai Chat in React Native - Expo</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Mon, 26 Feb 2024 05:12:42 +0000</pubDate>
      <link>https://dev.to/felipelujan/ai-chat-in-react-native-expo-1adm</link>
      <guid>https://dev.to/felipelujan/ai-chat-in-react-native-expo-1adm</guid>
      <description>&lt;p&gt;Implementing an AI Chat in React Native in 20 minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3eclzpnwbn0ryuyx49p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3eclzpnwbn0ryuyx49p.png" alt="Image description" width="404" height="828"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'll walk you through configuring Nader Dabit's React Native AI repo with Google's Gemini. &lt;/p&gt;

&lt;h2&gt;
  
  
  prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;NodeJS&lt;/li&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;Expo CLI&lt;/li&gt;
&lt;li&gt;Windows + Android Simulator or a Mac + iOS Simulator.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  React Native AI structure
&lt;/h2&gt;

&lt;p&gt;React Native AI is a project made out of two parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend: An Expo project that you can run in iOS and/or Android&lt;/li&gt;
&lt;li&gt;Backend: A NodeJS project that takes user requests and communicates with an LLM. You can use OpenAI, Cohere, Claude, or &lt;em&gt;Gemini&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  API Access to Google Gemini
&lt;/h2&gt;

&lt;p&gt;Gemini is accessible through 2 APIs. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google Cloud's Vertex AI, for which you'd use &lt;code&gt;@google-cloud/aiplatform&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@google/generative-ai&lt;/code&gt; for which you can get an API Key in Google AIStudio&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The latter is more straightforward to set up and is what React Native AI uses, so let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up React Native AI with Google Gemini
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Generate a Gemini API Key
&lt;/h3&gt;

&lt;p&gt;Head over to &lt;a href="https://aistudio.google.com/"&gt;https://aistudio.google.com/&lt;/a&gt; and create an API Key&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhao7gl27fq5sqrotttv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhao7gl27fq5sqrotttv.png" alt="Image description" width="715" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Create API key.&lt;br&gt;
&lt;em&gt;Do not share your API Key online&lt;/em&gt;, you know, the code that looks like &lt;em&gt;Kg1kQ2r5IdXTGWrEKKH8R6s9OLRP&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Clone React Native AI
&lt;/h3&gt;

&lt;p&gt;In your IDE, run &lt;code&gt;git clone https://github.com/dabit3/react-native-ai.git&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Set up the backend server
&lt;/h3&gt;

&lt;p&gt;Once you've cloned the main repository, install dependencies and set up your API key by running the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd server/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Mac &lt;code&gt;export GEMINI_API_KEY=YOUR_API_KEY&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;in Windows Powershell &lt;code&gt;$Env:GEMINI_API_KEY = "YOUR_API_KEY"&lt;/code&gt;
Finally:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start                                                    

&amp;gt; server@1.0.0 start
&amp;gt; node dist/index.js

Server started on port 3050
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not close the terminal session when following further steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the frontend React Native (Expo) App.
&lt;/h2&gt;

&lt;p&gt;Start a new terminal session on the root directory of the React Native AI repository, then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd app/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
:&lt;br&gt;
Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Mac &lt;code&gt;export EXPO_PUBLIC_ENV=DEVELOPMENT&lt;/code&gt; also run &lt;code&gt;export EXPO_PUBLIC_DEV_API_URL=http://localhost:3050&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;in Windows Powershell &lt;code&gt;$Env:EXPO_PUBLIC_ENV = "DEVELOPMENT"&lt;/code&gt; also run &lt;code&gt;$Env:EXPO_PUBLIC_DEV_API_URL = "http://localhost:3050"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a few seconds you'll see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;› Using Expo Go
› Press s │ switch to development build

› Press a │ open Android
› Press i │ open iOS simulator
› Press w │ open web

› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu
› Press o │ open project code in your editor

› Press ? │ show all commands
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press I if you're using a Mac and want to run the Expo Go app in an iOS emulator (requires Xcode), or press A for running the app on the Android Emulator (requires Android Studio).&lt;br&gt;
Alternatively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Success!!! Using Gemini in a React Native App
&lt;/h2&gt;

&lt;p&gt;Select Gemini as the model to use in conversations&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp8e1tkt4upx737x18zh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp8e1tkt4upx737x18zh5.png" alt="Image description" width="540" height="1077"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup3vv6opu32tcp07nov8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup3vv6opu32tcp07nov8.png" alt="Image description" width="433" height="846"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqy4q5pis83pobwwb481p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqy4q5pis83pobwwb481p.png" alt="Image description" width="390" height="831"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks again to Nader Dabit for sharing the React Native AI project on Github&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>gemini</category>
      <category>ios</category>
      <category>openai</category>
    </item>
    <item>
      <title>🦜🔗Langchain without code -&gt; LangFlow</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Sun, 10 Sep 2023 18:10:40 +0000</pubDate>
      <link>https://dev.to/felipelujan/langchain-without-code-langflow-49lh</link>
      <guid>https://dev.to/felipelujan/langchain-without-code-langflow-49lh</guid>
      <description>&lt;p&gt;Langflow is also an excellent option for using Lngchain without code. It uses Python under the hood.&lt;/p&gt;

&lt;p&gt;A feature I particularly love about Lanflow is support for custom actions within your flows. Let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  First-time set up
&lt;/h2&gt;

&lt;p&gt;On Windows. I got Langflow to work by installing Python 3.10.11 (&lt;a href="https://www.python.org/downloads/release/python-31011/"&gt;download here&lt;/a&gt; ), as well as install C++ build tools, which you can &lt;a href="https://visualstudio.microsoft.com/downloads/?q=build+tools"&gt;download here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;With those prerequisites ready, run the following commands inside the folder where you want to install LangFlow&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Windows&lt;/strong&gt;: shift + right click &amp;gt; Open in terminal&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BEL7-NEE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46zvq65htv2i4i8828im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BEL7-NEE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46zvq65htv2i4i8828im.png" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Mac&lt;/strong&gt;: In Finder, activate the path bar by clicking View &amp;gt; Show path bar.&lt;br&gt;
In the path bar, right-click your target folder and click Open in terminal&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Windows &amp;amp; MacOS:&lt;/strong&gt; Type &lt;code&gt;python -m venv langflow&lt;/code&gt;.&lt;br&gt;
 &lt;br&gt;
&lt;strong&gt;Windows&lt;/strong&gt;:Type  &lt;code&gt;.\langflow\Scripts\activate&lt;/code&gt;.&lt;br&gt;
 &lt;br&gt;
&lt;strong&gt;MacOS&lt;/strong&gt;: Type &lt;code&gt;source ./langflow/bin/activate&lt;/code&gt;.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You might need to restart your terminal at this point&lt;br&gt;
Back in your terminal, type:&lt;br&gt;
 &lt;br&gt;
&lt;strong&gt;Windows &amp;amp; MacOS&lt;/strong&gt;: &lt;code&gt;pip install langflow&lt;/code&gt; this will take a few minutes; when done&lt;br&gt;
 &lt;br&gt;
&lt;strong&gt;Windows &amp;amp; MacOS:&lt;/strong&gt; &lt;code&gt;python -m langflow&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your web browser, go to &lt;a href="http://127.0.0.1:7860"&gt;http://127.0.0.1:7860&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Welcome to langflow
&lt;/h2&gt;

&lt;p&gt;You'll notice by the options at the center top that LangFlow has two main sections, Your Flows (Collections) and Flows shared by the community.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create your first Langchain application without code.
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You'll create an LLM app that helps users improve prompts for generating images in Midjourney. For example:&lt;br&gt;
A simple "&lt;em&gt;image of a house&lt;/em&gt;" becomes a &lt;em&gt;"beautiful house from fairy tales, sunny spring morning, vibrant colors, award-winning composition"&lt;/em&gt;  which should help the app user generate better images.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: At the time of writing this article, the chat-bison model and VextexAI embeddings are not supported out-of-the-box by Langflow. Limiting options substantially.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In Langflow, head over to &lt;strong&gt;Community examples&lt;/strong&gt; &amp;gt; &lt;strong&gt;MidJourney Prompt Chain&lt;/strong&gt;.
You'll see a flow similar to the screenshot below.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xymx4qW5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekpxaps6naiynjxpdwjl.png" alt="Image description" width="800" height="361"&gt;
 &lt;/li&gt;
&lt;li&gt;Click the OpenAI LLM box and then &lt;strong&gt;delete&lt;/strong&gt;.
In the left-hand side panel, expand the LLM section and drag and drop the VertexAI element onto the canvas.
 &lt;/li&gt;
&lt;li&gt;Introduce the Following Parameters
&lt;strong&gt;Credentials:&lt;/strong&gt; Browse and select your Service Account JSON file. Follow this guide to generate one.
&lt;strong&gt;Location: **us-central1
Model Name: text-bison
**Project:&lt;/strong&gt; Your Google Cloud Project ID is available here.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xCa-A-Jd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gid48n0o6ulk9k8vf6i2.png" alt="Image description" width="800" height="263"&gt;
 &lt;/li&gt;
&lt;li&gt;Connect the VertexAI node to the LLM model node in 
&lt;strong&gt;ConversationalSummaryMemory&lt;/strong&gt;, as well as to the LLM node in &lt;strong&gt;MidJourneyPromtChain&lt;/strong&gt;. Like this:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--27f4ODEw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rguf0qj7ty5v8wkddeb2.png" alt="Image description" width="800" height="596"&gt;
 &lt;/li&gt;
&lt;li&gt;Click the lightning icon and then the chat icon at the bottom right of Langflow.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using your LLM app
&lt;/h2&gt;

&lt;p&gt;Interacting with LLM apps in Langflow is very similar to using other chatbots. In my case, I sent:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;macro picture of a dog&lt;br&gt;
and got back&lt;br&gt;
A close-up of a dog's face, with its tongue hanging out and its eyes half-closed in contentment. The dog's fur is a light brown, and its ears are perked up. The background is a blurry green, with a few blades of grass in focus.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  The difference it makes.
&lt;/h3&gt;

&lt;p&gt;I currently don't have Midjourney access, but the same principle should apply to Google's Imagen text-to-image technology.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sq9Oihp0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/23soobb6cubtou0c3vg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sq9Oihp0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/23soobb6cubtou0c3vg7.png" alt="Image description" width="494" height="345"&gt;&lt;/a&gt;&lt;br&gt;
The prompt generated by my app&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lfingTd3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezcfz1uk479qy3fb0fuj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lfingTd3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezcfz1uk479qy3fb0fuj.png" alt="Image description" width="745" height="327"&gt;&lt;/a&gt;&lt;br&gt;
You can definitely tell that the images generated with the improved prompt are more vibrant and visually appealing, although the results using the plain prompt are pretty good as well.&lt;/p&gt;

&lt;p&gt;Congratulations!!! You've created your first LLM app.&lt;/p&gt;

</description>
      <category>langchain</category>
      <category>langflow</category>
      <category>nocode</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🦜🔗Langchain without code -&gt; Flowise</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Fri, 08 Sep 2023 03:05:07 +0000</pubDate>
      <link>https://dev.to/felipelujan/langchain-without-code-flowise-1l6a</link>
      <guid>https://dev.to/felipelujan/langchain-without-code-flowise-1l6a</guid>
      <description>&lt;p&gt;In this article, I will explain how to get started with Flowise using Google's foundation model, Palm2. I assume you already have a service account with access to the VertexAI API. If you don't, &lt;a href="https://dev.to/felipelujan/build-llm-apps-without-coding-langchain-12i2"&gt;follow this guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing NodeJS on Windows and Mac.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href="//Node.js%20Downloads%20page"&gt;Node.js&lt;/a&gt; Downloads page.&lt;/li&gt;
&lt;li&gt;Click either the Windows installer or the MacOS installer. &lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Windows, run the downloaded Node.js .msi Installer. For Mac, Run the .pkg installer. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Installing Flowise:&lt;br&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: Press Windows key + r and type &lt;code&gt;powershell&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;MacOS&lt;/strong&gt;: Press command + space bar and type &lt;code&gt;terminal&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Windows &amp;amp; MacOS&lt;/strong&gt;: Write &lt;code&gt;npm install -g flowise&lt;/code&gt;  (might require elevated privileges)&lt;br&gt;
&lt;strong&gt;Windows &amp;amp; MacOS&lt;/strong&gt;: Write &lt;code&gt;npx flowise start&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your web browser, go to &lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
Voila! Welcome to Flowise.🥳🥳🥳&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using Flow Creating your first 🦜🔗Langchain app.
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;You will create an app that behaves like an English teacher who talks about any topic and patiently corrects your grammar.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;In Flowise click &lt;strong&gt;Marketplace&lt;/strong&gt; &amp;gt; &lt;strong&gt;Translator&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Use template&lt;/strong&gt;, save, and give your app a name.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To replace ChatOpenAI with Google Palm2, Hover over the ChatOpenAI action in your diagram and click the delete button. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yXZHbW3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/242heu4r3apryszjsey3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yXZHbW3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/242heu4r3apryszjsey3.png" alt="Image description" width="338" height="143"&gt;&lt;/a&gt;&lt;br&gt;
Click + sign on the top left part of your screen and find the **ChatGoogleVertexAI **option under Chat Models. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2_k8htMy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/da8aolpbyg8ilfyc3hss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2_k8htMy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/da8aolpbyg8ilfyc3hss.png" alt="Image description" width="433" height="439"&gt;&lt;/a&gt;&lt;br&gt;
Drag and drop it into the canvas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configuring the ChatGoogleVertexAI model: Under &lt;strong&gt;Connect Credential&lt;/strong&gt;, select &lt;strong&gt;Create New&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;&lt;u&gt;CREDENTIAL NAME&lt;/u&gt;&lt;/strong&gt;: VertexAI credentials&lt;br&gt;
&lt;strong&gt;&lt;u&gt;Credential JSON Object&lt;/u&gt;&lt;/strong&gt;: The contents of the JSON file you recently downloaded from Google Cloud.&lt;br&gt;
&lt;strong&gt;&lt;u&gt;Project ID&lt;/u&gt;&lt;/strong&gt;: Your Google Cloud Project ID. You can find it here:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lVZ0BKmO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8zzvyjhjyoxqd76in5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lVZ0BKmO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8zzvyjhjyoxqd76in5n.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect the language model node from &lt;strong&gt;ChatGoogleVertexAI&lt;/strong&gt; to LLM Chain.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6Np32ZKX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lf5nzw8j5rf1ujebkvt8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6Np32ZKX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lf5nzw8j5rf1ujebkvt8.png" alt="Image description" width="487" height="108"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the Chat Promp Template box, replace the System Message with this:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;you are a language teacher teacher having a conversation with a student in {input_language}&lt;/em&gt;&lt;br&gt;
&lt;em&gt;When the text sent by the student contains wrong grammar, you will reply by sending back the corrected message as "corrected" and a follow-up message on the conversation topic as "follow-up". Include emojis.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Your responses should be formatted like this:&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Corrected:&lt;/em&gt;&lt;br&gt;
&lt;em&gt;follow-up:&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Save and click the chat icon to start using your first LLM app.🤯🤯🤯&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WjoKIvYv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2h6hl9kcvmewytiy453f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WjoKIvYv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2h6hl9kcvmewytiy453f.png" alt="Image description" width="360" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>langchain</category>
      <category>javascript</category>
      <category>gcp</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Build LLM apps without coding. Langchain 🦜🔗</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Fri, 08 Sep 2023 02:34:35 +0000</pubDate>
      <link>https://dev.to/felipelujan/build-llm-apps-without-coding-langchain-12i2</link>
      <guid>https://dev.to/felipelujan/build-llm-apps-without-coding-langchain-12i2</guid>
      <description>&lt;p&gt;A comprehensive guide on using Langflow and Flowise for building Langchain apps with Google's PALM2 LLM. &lt;/p&gt;

&lt;p&gt;This article starts a new series on langchain from the low-code/no-code perspective, where you'll learn how to create LLM apps using visual scripting.&lt;br&gt;
If JavaScript is your territory, that would be Flowise, and for Python enthusiasts, the tool would be Langflow. &lt;/p&gt;

&lt;p&gt;Most of the Langchain guides on the internet use OpenAI's GPT3.5 or GTP4, but I will use Google's Palm2 in this series, given that you get 300 USD when you sign up for Google Cloud for the first time. &lt;br&gt;
I signed up in Canada and got 500+ CAD of credits; much more than the 5 USD you get for free with OpenAI.&lt;/p&gt;

&lt;p&gt;You will need a service account with access to VertexAI; this is the identity under which Langchain will communicate with Google Cloud. Quick note: Using your primary Google Account for Langchain is a bad idea, as that account has god-level permissions on your Google Cloud project. Use a service account with limited permissions instead. &lt;/p&gt;

&lt;h2&gt;
  
  
  Enabling the Vertex AI API
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href="https://console.cloud.google.com/"&gt;Google Cloud console&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;hamburger menu&lt;/strong&gt; in the top left corner of the page.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;APIs &amp;amp; Services&lt;/strong&gt; &amp;gt; &lt;strong&gt;Library&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Search for "Vertex AI."&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Vertex AI API&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Enable&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Creating a service account in Google Cloud
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;hamburger menu&lt;/strong&gt; in the top left corner of the page.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;IAM &amp;amp; Admin&lt;/strong&gt; &amp;gt; &lt;strong&gt;Service accounts&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create service account&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a name for the service account. Click Create and Continue.&lt;/li&gt;
&lt;li&gt;Grant the service account the &lt;strong&gt;Vertex AI User&lt;/strong&gt; role.&lt;/li&gt;
&lt;li&gt;(Optional) Enter a description for the service account.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Done&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, you'll see the list of service accounts available in your project for downloading the JSON Key of your newly created service account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Downloading the JSON key
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Click the email address of the new service account.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Keys&lt;/strong&gt;tab.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Add key&lt;/strong&gt; drop-down menu.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Create new key&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;JSON&lt;/strong&gt;as the key type.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Download your key and store it &lt;strong&gt;securely&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Anyone with this JSON file might use your service account on your behalf; do NOT share it online.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/felipelujan/langchain-without-code-flowise-1l6a"&gt;Create your first LLM app with Flowise(JS-based)&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[WIP]Create your first LLM app with Flowise LangFlow(Python-based) &lt;/p&gt;

</description>
      <category>langchain</category>
      <category>begginers</category>
      <category>nocode</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>1200 USD gone in unmonitored cloud spending😭😭😭</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Thu, 03 Aug 2023 23:45:59 +0000</pubDate>
      <link>https://dev.to/felipelujan/1200-usd-gone-in-unmonitored-cloud-spending-cce</link>
      <guid>https://dev.to/felipelujan/1200-usd-gone-in-unmonitored-cloud-spending-cce</guid>
      <description>&lt;p&gt;As a GDE in the GCP category, I consider myself a well-seasoned user in topics such as cloud infrastructure, data and compute migrations, and management of  IaaS/PaaS offerings from GCP. &lt;br&gt;
GCP has evolved a lot since I became a GDE, with Vertex AI being the technology that I'm trying to catch up on, especially regarding pricing.&lt;/p&gt;

&lt;p&gt;The most significant mishap of my learning journey? *&lt;em&gt;1200+ USD of unmonitored spending piled up in VertexAI usage during July of 2023 alone.&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The root cause.
&lt;/h2&gt;

&lt;p&gt;I was under the impression that models from Vertex's Model Garden worked in a "per request" or "Per use" model; needless to say, they don't.&lt;/p&gt;

&lt;p&gt;The new offerings —Palm2 chat and Text generation, Code completion, and Code Chat— will charge you a small amount per 1000 characters, billing you on a "per-request" or "per-inference". However, deploying models from the Model Garden works differently.&lt;/p&gt;

&lt;p&gt;Deploying those models require dedicated CPU, RAM, and GPU; therefore, you're billed for those resources independently. I learned this after the fact.&lt;/p&gt;

&lt;p&gt;A post-mortem analysis shows spendings accumulating during the month :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdkel8iy5bvw9q8j4twq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdkel8iy5bvw9q8j4twq.png" alt=" " width="800" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The devil is in the details.
&lt;/h2&gt;

&lt;p&gt;I always set up fairly conservative billing alerts; So, How did 1200 USD disappear without me noticing?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It turns out, Discount usage does not qualify as Spending in GCP's billing system. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;One could argue that resource consumption causes spending regardless if credits are being consumed or credit cards are being charged, but GCP doesn't work like that at the moment. Link to Documentation.&lt;/p&gt;

&lt;p&gt;Due to that subtle difference in terminology, the alert I set up at 200 USD never triggered, and neither did those at 450 USD and 500 USD.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flayzz7dhsfk5md3jg5vm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flayzz7dhsfk5md3jg5vm.png" alt=" " width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  No signs of intrusions or leaked credentials.
&lt;/h2&gt;

&lt;p&gt;At some point, I was afraid I might have leaked credentials in a Jupyter Notebook or that a malicious Notebook author had accessed my GCP project. The proof that seems to discard such a hypothesis is the Vertex AI API logs, which show nothing but sporadic use.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg0pq7wdysuv391ju8czj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg0pq7wdysuv391ju8czj.png" alt=" " width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion.
&lt;/h2&gt;

&lt;p&gt;Regular GCP customers will hardly find themselves in a similar situation; nevertheless, capping API usage is the safest option for preventing unexpected spending.&lt;br&gt;
Also, remember that you can use BigQuery to explore to analyze billing data.&lt;br&gt;
Technicalities aside, keeping an eye on your cloud infrastructure's billing panel and maintaining an inventory will always be in fashion.&lt;/p&gt;

</description>
      <category>google</category>
      <category>billing</category>
      <category>ai</category>
      <category>vertexai</category>
    </item>
    <item>
      <title>Automate your Print-on-Demand business with AI</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Wed, 19 Jul 2023 02:40:38 +0000</pubDate>
      <link>https://dev.to/felipelujan/automate-your-print-on-demand-business-with-ai-2j97</link>
      <guid>https://dev.to/felipelujan/automate-your-print-on-demand-business-with-ai-2j97</guid>
      <description>&lt;p&gt;TLDR; Run your product's pictures through an image captioning AI model to obtain a one-line basic description, and use that as input of an LLM that gives you title, description, and tags.&lt;/p&gt;

&lt;p&gt;Scale is the key to success in Print-on-Demand (POD). &lt;/p&gt;

&lt;p&gt;Platforms like Etsy.com and Redbubble reward active owners that create daily listings with more visibility and traffic.&lt;/p&gt;

&lt;p&gt;In the era of generative AI, tools such as Midjourney, Adobe Firefly, and Stable Difussion help POD creators come up with dozens of new designs every day, but creating tailored—and more critical, SEO-optimized— Titles, descriptions, and tags is still a laborious task.&lt;/p&gt;

&lt;p&gt;In this article, I will explain how to use two AI models, one that detects the content of product pictures and another for generating product descriptions, titles, and hashtags.&lt;br&gt;
Those AI models are Blip-image-captioning and Palm 2, both available in Google Cloud's Vertex AI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started.
&lt;/h2&gt;

&lt;p&gt;To deploy the image captioning model, go to &lt;a href="https://console.cloud.google.com" rel="noopener noreferrer"&gt;https://console.cloud.google.com&lt;/a&gt; and type vertex AI in the search bar on the mid-top section of your screen.&lt;br&gt;
Once there, click the model garden option on the left-hand side.&lt;br&gt;
Use the search function to find the Blip image captioning model.&lt;/p&gt;

&lt;p&gt;I will use the provided Colab notebook to deploy the Blip captioning model to an endpoint. &lt;a href="https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/20?authuser=1&amp;amp;project=optical-bond-240720" rel="noopener noreferrer"&gt;Direct link&lt;/a&gt;&lt;br&gt;
The notebook contains comprehensive steps explaining each code block's purpose and end result. The initial config steps consist of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Indicating a Google Cloud Project ID.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Google Cloud Storage (GCS) bucket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choosing a region for deploying the AI model.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The notebook shows the following example of two kittens lying on a pink blanket, for which the Blip captioning Model generates the following Caption &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdt4ytm0usgrcsdozkag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdt4ytm0usgrcsdozkag.png" alt=" " width="640" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;two cats sleeping on a couch with a remote control.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Colab makes it very simple to pass another image to the model; paste in a URL of a picture of one of your products.&lt;/p&gt;

&lt;p&gt;An example from real life.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fffajr0mpnath0g52b3jo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fffajr0mpnath0g52b3jo.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Caption: a handmade gold ring with a texture pattern &lt;a href="https://www.etsy.com/listing/203998622/22k-gold-wedding-band-set-rustic-wedding?click_key=9b806cb5b8bf8e59b26de76f4dfebc204052b6b2%3A203998622&amp;amp;click_sum=b79da682&amp;amp;ref=hp_editors_picks_primary-4" rel="noopener noreferrer"&gt;source&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Generating titles, descriptions, tags, and social media posts.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With the image caption part ready, we can provide Google's Palm 2 LLM  some context, from which it will generate the necessary text to complement your product listing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enabling Palm2.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpbuehty9aaiiywn304t3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpbuehty9aaiiywn304t3.png" alt=" " width="538" height="604"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Palm2 is available on demand without requiring a one-time deployment as the Blip captioning model does.&lt;br&gt;
Select Palm2 from the models available in the Model Garden, or select &lt;strong&gt;Language&lt;/strong&gt;, under Generative AI studio.&lt;br&gt;
You will see a Chat-like interface where you can write prompts for Palm 2 to execute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine you work in an online retail store.&lt;br&gt;
Write an SEO-optimized product title, a new description, and 5 tags based on the product caption provided below. The title must be up to 40 characters long, the description should be about 50 words long, and the tags should be up to 20 characters each.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example&lt;/strong&gt;&lt;br&gt;
Caption: Kid wearing black and white pijamas.&lt;br&gt;
Title: &lt;br&gt;
Pijama for kids,  Son daughter gift, Birthday gift for kids, black and white pijama set, matching pijamas for kids&lt;br&gt;
Description:&lt;br&gt;
Looking for the perfect gift for your son or daughter? Look no further than our black and white Pijama set! Made from soft and comfortable materials, these matching Pijama are perfect for kids of all ages. Whether it’s for a birthday or just a special treat, your child will love snuggling up in their new Pijama.&lt;br&gt;
Our Pijama set is not only stylish but also practical. The black and white design is timeless and will never go out of style. Plus, the matching set makes it easy for siblings to coordinate their bedtime looks.&lt;br&gt;
Don’t wait, order now and give your child the gift of comfort and style. With our black and white Pijama set, bedtime has never been so fun! 🛍️🎁&lt;br&gt;
Tags:&lt;br&gt;
Kids Pijama&lt;br&gt;
Son Daughter Gift&lt;br&gt;
Birthday Gift Kids&lt;br&gt;
Black White Pijama&lt;br&gt;
Matching Pijama Kids&lt;/p&gt;

&lt;p&gt;Caption: a handmade gold ring with a texture pattern&lt;br&gt;
Title:&lt;br&gt;
Description:&lt;br&gt;
Tags&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Prompt Design.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I'm using a technique known as one-shot prompting. By providing an example of the expected output, Palm2 will better understand the type of response I'm expecting.&lt;/li&gt;
&lt;li&gt;The prompt denotes the expected structure for the Title, Description, and Tags; Palm2 specifically tends to generate bullets and lists. I'm indirectly instructing the LLM to follow this structure by structuring the output as single lines.
### Palm2's generated title, description and tags.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Title:&lt;br&gt;
Textured gold ring, handcrafted, minimalist jewelry, unique ring&lt;/p&gt;

&lt;p&gt;Description:&lt;br&gt;
This textured gold ring is a unique and stylish addition to any jewelry collection. It is handcrafted with 14k gold and features a textured pattern that adds interest and dimension. The ring is available in a variety of sizes, so you can find the perfect fit for your finger.&lt;/p&gt;

&lt;p&gt;This ring is perfect for everyday wear or for special occasions. It is also a great gift for loved ones.&lt;/p&gt;

&lt;p&gt;Tags:&lt;br&gt;
Gold ring&lt;br&gt;
Textured ring&lt;br&gt;
Handcrafted jewelry&lt;br&gt;
Minimalist jewelry&lt;br&gt;
Unique ring&lt;/p&gt;

&lt;h2&gt;
  
  
  In Summary
&lt;/h2&gt;

&lt;p&gt;By leveraging Google's foundation models and the AI models available in the model garden, POD entrepreneurs can expedite the product creation process by automating the generation of SEO-optimized titles, descriptions, and hashtags from images.&lt;br&gt;
The quality and veracity of the generated text must be audited. In my experiment, the model generated content containing the word woman, even though I never specified that the gold ring was meant to be used by men or women. &lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>googlecloud</category>
      <category>vertexai</category>
      <category>generative</category>
      <category>ai</category>
    </item>
    <item>
      <title>How to install Stable Difussion WebUI and ControlNet 1.1 on Ubuntu</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Sat, 22 Apr 2023 22:42:26 +0000</pubDate>
      <link>https://dev.to/felipelujan/set-up-stable-difussion-webui-and-controlnet-on-ubuntu-2204-hbm</link>
      <guid>https://dev.to/felipelujan/set-up-stable-difussion-webui-and-controlnet-on-ubuntu-2204-hbm</guid>
      <description>&lt;p&gt;In this tutorial, I will explain how to configure Ubuntu 22.04 to take advantage of an Nvidia GPU and run stable Diffusion via Stable-diffusion-webui.&lt;br&gt;
This is a permanent alternative as Google might restrict the use of Colab for Stable Difussion in the future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stable-diffusion-webui Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.10.6 (Comes with Ubuntu 22.04).&lt;/li&gt;
&lt;li&gt;Git (Comes with Ubuntu 22.04).&lt;/li&gt;
&lt;li&gt;Python venv&lt;/li&gt;
&lt;li&gt;Nvidia drivers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since I don't have a Linux Machine At home, I will use a virtual machine on &lt;strong&gt;Google Compute Engine&lt;/strong&gt;. If you're not using a VM and just want to know how to install stable difussion feel free to skip this section.&lt;/p&gt;
&lt;h1&gt;
  
  
  Creating the virtual machine.
&lt;/h1&gt;

&lt;p&gt;Sign in to Google Cloud and type Compute Engine on the search bar located on the top of your screen.&lt;br&gt;
Make sure that billing is enabled for your Cloud project.&lt;br&gt;
Enable the Compute Engine API if prompted.&lt;br&gt;
On the Compute Engine page, click Create an instance.&lt;br&gt;
In the Machine Configuration section, click on the GPUs tab, select NVIDIA T4, and 1 in the number of GPUs.&lt;br&gt;
Under Machine type, select n1-standard-4.&lt;/p&gt;

&lt;p&gt;Click Change in the Boot Disk section to begin configuring your boot disk and Ubuntu 22.04 LTS from the version list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqn7njqt741fhuf8vsrmj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqn7njqt741fhuf8vsrmj.png" alt="Creating a VM for Stable Difussion"&gt;&lt;/a&gt;&lt;br&gt;
Configure any additional settings as needed, such as allowing HTTP traffic in the Firewall section.&lt;br&gt;
Click Create to create the VM.&lt;br&gt;
Once the VM is ready, click the SSH button to enter the command line terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml0q41zzvnp2q47ebdmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml0q41zzvnp2q47ebdmw.png" alt="How to SSH into Ubuntu VM"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Preparing Ubuntu 22.04
&lt;/h1&gt;

&lt;p&gt;From this point on, make sure to run all the commands on the same directory:&lt;/p&gt;
&lt;h2&gt;
  
  
  Update and upgrade system packages
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;you might encounter a couple of purple screens like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1uvmef2953pnobjo8v1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1uvmef2953pnobjo8v1.png" alt="How to update Ubuntu Kernel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit enter without changing the defaults.&lt;/p&gt;
&lt;h2&gt;
  
  
  Install Nvidia drivers.
&lt;/h2&gt;

&lt;p&gt;Run the following commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt -y install nvidia-driver-525-server &amp;amp;&amp;amp; sudo apt -y install nvidia-utils-525-server \ sudo apt -y install nvidia-cuda-toolkit 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reboot
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Python-venv
&lt;/h2&gt;

&lt;p&gt;Once the machine is back up, install &lt;strong&gt;Python3-venv&lt;/strong&gt; with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install python3.10-venv -y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Prerequisites check.
&lt;/h1&gt;

&lt;p&gt;To verify that the prerequisites are correctly installed and available on the local machine run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -V

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output: &lt;code&gt;Python 3.10.6&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvidia-smi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output (similar):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkizezhr2hq3z7jopc2dy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkizezhr2hq3z7jopc2dy.png" alt="nvidia-smi correctly installed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running the following command should not output any errors&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -c 'import venv'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Installing and running Automatic1111's Stable-Difussion-Webui.
&lt;/h1&gt;

&lt;p&gt;Run the following command (source). It might take a few minutes while it downloads and prepares the application components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash &amp;lt;(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh) --listen --enable-insecure-extension-access 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;note: The &lt;code&gt;--listen&lt;/code&gt; and &lt;code&gt;--enable-insecure-extension-access&lt;/code&gt; command line arguments allow you to access and install Stable difussion extionsions remotely, if you are using a physical Ubuntu Machine, feel free to remove them.&lt;/p&gt;

&lt;p&gt;Installation is complete when you see:&lt;br&gt;
&lt;strong&gt;Running on local URL:  &lt;a href="http://0.0.0.0:7860" rel="noopener noreferrer"&gt;http://0.0.0.0:7860&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're following along in Google Cloud, grab the virtual machine's public IP from Google Compute Engine, paste it on your browser's address bar, followed by &lt;strong&gt;:7860&lt;/strong&gt;, and press enter. In a physical ubuntu machine enter localhost:7860 in your web browser. &lt;/p&gt;
&lt;h2&gt;
  
  
  Welcome to Automatic1111's Stable Diffusion Webui.
&lt;/h2&gt;

&lt;p&gt;Happy prompting!&lt;/p&gt;
&lt;h1&gt;
  
  
  Enable ControlNet
&lt;/h1&gt;

&lt;p&gt;With ControlNet, you have much more power regarding image-to-image generation. It enables things such as pose transfer and style transfer.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing ControlNet.
&lt;/h2&gt;

&lt;p&gt;On Automatic1111's webui, go to the &lt;strong&gt;Extensions&lt;/strong&gt; tab, hit &lt;strong&gt;Available&lt;/strong&gt;, and then &lt;strong&gt;Load From&lt;/strong&gt;.&lt;br&gt;
Find &lt;strong&gt;sd-webui-controlnet&lt;/strong&gt; in the list populates and click install.&lt;br&gt;
Wait until processing finishes.&lt;br&gt;
Go back to the &lt;strong&gt;Installed&lt;/strong&gt; tab right next to Available, Click &lt;strong&gt;Apply and restart UI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Wait a couple of minutes before refreshing the website. &lt;br&gt;
You should see the ControlNet section when the UI reloads.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdjasvpjfxhd9hvd0qbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdjasvpjfxhd9hvd0qbc.png" alt="ControlNet extension Installed on Stable Difussion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To complete the installation of Controlnet you need to download the models that go along with it. &lt;br&gt;
Start a new SSH session (or open a new terminal on a physical computer), Paste the following commands on the new command line terminal to download the ControlNet models from  HuggingFace.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install git-lfs
git lfs install
git clone https://huggingface.co/lllyasviel/ControlNet-v1-1
mv  ControlNet-v1-1/* stable-diffusion-webui/models/ControlNet/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the models in the ControlNet section show up in the models dropdow, then you're set!!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fap3jfcfefxbvyp9jtd4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fap3jfcfefxbvyp9jtd4q.png" alt="ControlNet models installed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With that, we've finished the installation of stable-diffusion-webui and ControlNet version 1.1&lt;br&gt;
Some good resources for finding the Stable Diffusion models  and tutorials are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stable Diffusion Subreddit&lt;/li&gt;
&lt;li&gt;Hugging Face&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please let me know if you have any issues replicating this procedure.&lt;br&gt;
Cheers!&lt;/p&gt;

</description>
      <category>stabledifussion</category>
      <category>controlnet</category>
      <category>setup</category>
      <category>txt2img</category>
    </item>
    <item>
      <title>How to install Git LFS on Debian</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Thu, 16 Mar 2023 16:46:15 +0000</pubDate>
      <link>https://dev.to/felipelujan/how-to-install-git-lfs-on-debian-10db</link>
      <guid>https://dev.to/felipelujan/how-to-install-git-lfs-on-debian-10db</guid>
      <description>&lt;h2&gt;
  
  
  Why do we need Git LFS.
&lt;/h2&gt;

&lt;p&gt;To download those fancy AI models that generate images from a text prompt, ala Midjourney—but cheaper, one of the most important things you need to download is &lt;strong&gt;Git LFS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=izk9mnDNRKc" rel="noopener noreferrer"&gt;VIDEOTUTORIAL OF THIS PROCEDURE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Git LFS is a functionality of the well-known Source Control Management (SCM) technology that allows you to add large files in code repositories. From there, the LFS acronym, which means Large File System.&lt;/p&gt;

&lt;p&gt;The same concept applies when working on Virtual Machines on the cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to get Git LFS.
&lt;/h2&gt;

&lt;p&gt;It turns out that Git LFS doesn't come available out of the box in most Debian distributions; in fact, Git is often unavailable depending on the specific flavor of Debian. So in this article, I will explain &lt;strong&gt;how to enable git LFS on a Debian virtual machine&lt;/strong&gt;. I will use a virtual machine hosted in Google Compute Enine for this demonstration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8d5oh5wsc09mr4ed3uy8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8d5oh5wsc09mr4ed3uy8.png" alt=" " width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once logged in the Command Line Interface, the first step will be figuring out if Git is ready to go on the machine, for that just type &lt;code&gt;git --version&lt;/code&gt; in the command line&lt;br&gt;
You should get an output similar to this.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git version 2.30.2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you get :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git: command not found&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That means you don't have Git installed, let alone git LFS. But don't worry. With the following two commands, you can install a version of Git that is compatible with Git LFS.&lt;/p&gt;

&lt;p&gt;Note: If you have Git but LFS is not working, the following two commands will get you the most up-to-date version of Git, which is LFS-ready.&lt;/p&gt;

&lt;p&gt;Such is the case for the Deep Learning on Linux OS in Google Cloud.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhxtvs8etuscawmkok6u5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhxtvs8etuscawmkok6u5.png" alt=" " width="800" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One solution fits all.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Run:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh" rel="noopener noreferrer"&gt;This script&lt;/a&gt; tells our machine where to get git-lfs from, in other words, it's laying the foundations for installing git-lfs with the following command.&lt;/p&gt;

&lt;p&gt;Edit: also works to fix this error.&lt;br&gt;
&lt;code&gt;git: 'lfs' is not a git command. See 'git --help'.&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get install git-lfs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You're now set to use git LFS to clone large text-to-image models such as those from hugging face.&lt;/p&gt;

&lt;p&gt;For example, the repository for &lt;a href="https://huggingface.co/prompthero/openjourney-v2" rel="noopener noreferrer"&gt;openjourney-v2&lt;/a&gt;, a free version of Midjourney, contains a file that takes up 2.13Gb. Git LFS is a must if you want to clone the repository with the model.&lt;/p&gt;

&lt;p&gt;To download the whole repo, you run the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git lfs install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and then &lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clone https://huggingface.co/prompthero/openjourney-v2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If everything goes well, you will see something similar to this.&lt;br&gt;
&lt;code&gt;Cloning into 'openjourney-v2'...&lt;br&gt;
remote: Enumerating objects: 91, done.&lt;br&gt;
remote: Counting objects: 100% (91/91), done.&lt;br&gt;
remote: Compressing objects: 100% (88/88), done.&lt;br&gt;
remote: Total 91 (delta 34), reused 0 (delta 0), pack-reused 0&lt;br&gt;
Unpacking objects: 100% (91/91), 2.73 MiB | 8.84 MiB/s, done.&lt;br&gt;
Filtering content: 100% (5/5), 7.09 GiB | 57.55 MiB/s, done.&lt;/code&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>chatgpt</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Stable Diffusion Vs. The most powerful GPU. NVIDIA A100.</title>
      <dc:creator>Juan Felipe Lujan</dc:creator>
      <pubDate>Wed, 14 Sep 2022 03:22:38 +0000</pubDate>
      <link>https://dev.to/felipelujan/stable-diffusion-vs-the-most-powerful-gpu-nvidia-a100-ifi</link>
      <guid>https://dev.to/felipelujan/stable-diffusion-vs-the-most-powerful-gpu-nvidia-a100-ifi</guid>
      <description>&lt;p&gt;Earlier this week, I published a short on &lt;a href="https://www.youtube.com/watch?v=Ch1QHGBEZyw&amp;amp;ab_channel=FelipeLujan" rel="noopener noreferrer"&gt;my YouTube channel&lt;/a&gt; explaining how to run Stable diffusion locally on an Apple silicon laptop or workstation computer, allowing anyone with those machines to generate as many images as they want for absolutely FREE. It’s really quite amazing.&lt;/p&gt;

&lt;p&gt;Today I’ve decided to take things to a whole level. I will run Stable Diffusion on the most Powerful GPU available to the public as of September of 2022. The &lt;strong&gt;Nvidia Tesla A100&lt;/strong&gt; with 80 Gb of HBM2 memory, a behemoth of a GPU based on the ampere architecture and TSM's 7nm manufacturing process. Yup, that’s the same ampere architecture powering the RTX 3000 series, except that the A100 is a datacenter-grade GPU, or how Nvidia themselves call it: An enterprise-ready Tensor Core GPU.&lt;/p&gt;

&lt;p&gt;Unfortunately, I don’t have an A100 at home. Google’s got plenty for us to experiment with. However, using this type of GPU requires contacting Google Cloud’s customer support and submitting a &lt;a href="https://cloud.google.com/compute/quotas#requesting_additional_quota" rel="noopener noreferrer"&gt;quota increase request&lt;/a&gt;.&lt;br&gt;
In my request, I explained that I wanted to use Stable Diffusion. Therefore I needed one A100 80GB in the us-central1 region. The A100 80GB is in public preview.&lt;/p&gt;

&lt;p&gt;I already sent that request, Google approved it, and I am now ready to create a Linux VM with the most powerful GPU attached.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbbw2muz1npgljbvw1wq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbbw2muz1npgljbvw1wq.png" alt="Virtual machine configuration with an A100 GPU"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So in Google Compute Engine, I clicked “New Instance” I went to the GPU section and selected the Nvidia A100 80GB; this will automatically configure an &lt;code&gt;a2-ultragpu-1g&lt;/code&gt; machine type for me, which packs a 12vCPU and 170GB of RAM.&lt;br&gt;
As for the boot drive, I will select one of the images under Deep learning on Linux.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0dg31vuwye3qmkh6hck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0dg31vuwye3qmkh6hck.png" alt="Boot drive configuration screen in Compute Engine"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google Cloud will warn you if the selected boot drive image does not include CUDA drivers preinstalled. If you try to run Stable Diffusion UI in a VM without CUDA, it will fall back to CPU, making the image generation process atrociously slow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxe81l625ln5ugwd3j8o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxe81l625ln5ugwd3j8o.png" alt="Warning banner "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With everything set, I will SSH into the monstrous VM and finish the installation of Nvidia’s drivers.&lt;br&gt;
I could have partitioned the A100 down into multiple GPUs at this time, but that will be a test for another day.&lt;/p&gt;

&lt;p&gt;I chose the &lt;a href="https://github.com/cmdr2/stable-diffusion-ui" rel="noopener noreferrer"&gt;Stable Diffusion UI repo&lt;/a&gt; as it comes with a bash script that will automatically download and install all the necessary dependencies. It also starts a web server ready to get prompts and spit out images.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/cmdr2/stable-diffusion-ui/graphs/contributors" rel="noopener noreferrer"&gt;Thanks to all the contributors of Stable Diffusion UI.&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
Without further ado, I will download the compressed package, unzip it, and run the startup script as instructed in the repo's README file. After a few minutes, the user interface UI will start in port 9000.&lt;/p&gt;

&lt;p&gt;To see the UI, grab the ephemeral IP address of your VM from Google Compute Engine, paste it into the URL bar of your browser and add &lt;code&gt;:9000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pubea1rdn4z3gmmfh1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pubea1rdn4z3gmmfh1f.png" alt="Stable Diffusion UI"&gt;&lt;/a&gt;&lt;br&gt;
The first time you send a prompt, the server will download some stuff, so wait a couple more minutes before retrying.&lt;br&gt;
And that’s pretty much it in terms of configuration to make Stable Diffusion run on the Nvidia A100.&lt;/p&gt;

&lt;p&gt;Even though I never managed to use all the available VRAM one thing was for sure about the A100, It runs faster than a VM using the T4 GPU and much MUUCH faster than my little apple M1 MacBook air.&lt;/p&gt;

&lt;p&gt;If you want to replicate this experiment, there are three things that you have to keep in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; You might have to create a firewall rule in your Google Cloud Project to allow access to the Stable Diffusion UI in port 9000.&lt;/li&gt;
&lt;li&gt; This deployment will cost you 1.15 dollars per hour or 836.72 after the sustained use discount.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xewly2norsgqxf9hobx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xewly2norsgqxf9hobx.png" alt="Cost Breakdown of the A3-ultragpu-1g VM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; The 300-dollar free tier is not eligible for VMs with GPUs attached.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now a brief comparison.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╔═══════════════════════╦═════════╦═══════════╦═══════════╗
║        Device         ║ 512x512 ║ 1024x1024 ║ 1024x2048 ║
╠═══════════════════════╬═════════╬═══════════╬═══════════╣
║ MacBook Air M1 15Gb   ║ 138     ║ DNF       ║ DNF       ║
║ Nvidia T4 16 GB GDDR6 ║ 36.96s  ║ 281.01s   ║ DNF       ║
║ Nvidia A100 80Gb HBM2 ║ 14.05s  ║ 27.03s    ║ 92.78s    ║
╚═══════════════════════╩═════════╩═══════════╩═══════════╝
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When generating a 2048x2048, the &lt;code&gt;nvidia-smi&lt;/code&gt; command provides a deeper look at what's happening inside the A100.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4s4545b1yv0h6jmdx9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4s4545b1yv0h6jmdx9l.png" alt="Screenshot of nvidia-smi showing the GPU working at 100% of it's capacity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not even when asked to generate 20 2048x2048 images at once, the A100 gave up…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faaqv3i0xrdqgd7q1alcs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faaqv3i0xrdqgd7q1alcs.png" alt="nvidia-smi screenshot of A100 pulling 417W and 72125 MiB of VRAM used"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The prompt used throughout those tests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prompt: young female battle robot, award winning, portrait bust, symmetry, faded lsd colors, galaxy background, tim hildebrandt, wayne barlowe, bruce pennington, donato giancola, larry elmore, masterpiece, trending on artstation, cinematic composition, beautiful lighting, hyper detailed, Melancholic, Horrifying, 3D Sculpt, Blender Model, Global Illumination, Glass Caustics, 3D Render
    seed: 1259654
    num_inference_steps: 50
    guidance_scale: 7.5
    w: 2048
    h: 2048
    precision: autocast
    save_to_disk_path: None
    turbo: True
    use_cpu: False
    use_full_precision: True
    use_face_correction: GFPGANv1.3
    use_upscale: RealESRGAN_x4plus
    show_only_filtered_image: True 
    device cuda
Using precision: full
Global seed set to 1259654
Sampling:   0%|                                                                           | 0/1 [00:00&amp;lt;?, ?it/sseeds used =  [1259654, 1259655, 1259656, 1259657, 1259658, 1259659, 1259660, 1259661, 1259662, 1259663, 1259664, 1259665, 1259666, 1259667, 1259668, 1259669, 1259670, 1259671, 1259672, 1259673]
Data shape for PLMS sampling is [20, 4, 256, 256]
Running PLMS Sampling with 50 timesteps
PLMS Sampler:   6%|███▌            | 3/50 [10:10&amp;lt;2:26:11,186.63s/it]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This time it was me who DNF’ed out at 2:30 am after a long night of nerding around in GCP.&lt;/p&gt;

&lt;p&gt;Hope you found this journey interesting.&lt;/p&gt;

</description>
      <category>nvidia</category>
      <category>stablediffusion</category>
      <category>googlecloud</category>
      <category>a100</category>
    </item>
  </channel>
</rss>
