# Exploiting Google Colab for free Generative AI # ðŸ’ŧðŸŽĻ --- # 🐍 ## Python #### The Wizardry Behind the Scenes Python is a great tool - **Versatile** - **Expressive** - **Community-driven** ---- But from great responsibilities... - Is it scripting? - Is it OOP and packages? - Is it just a messy bunch of stuff? ---- # ⁉ïļ ## How should we use it? --- # 🊐📒 ## Jupyter #### Your Spellbook for Coding Adventures Making Python interactive & integrated with Markdown! ---- ### Jupyter Hub > Lab > Notebook ---- ![image](https://hackmd.io/_uploads/Hkdo4ZG3p.png) --- # 🊄âœĻ ## Google's Jupyter #### Where Wizards Code Their Spells Google created its own branch of Jupyter. It's called: ---- ![image](https://hackmd.io/_uploads/H1HPB-M3p.png) --- # 🐚 ## Commanding Magic #### Unleashing the Shell's Power Both Colab and Jupyter support "bypassing python". With a `!` in front of a code cell one can run in the underlying shell. ---- One can run `cat /proc/cpuinfo`. Or for example `ls ~`. Or even `curl www.google.com`. --- # 🚂🚋🚋🚋🚋 ## Let's go Hogwarts #### Get yourself your Colab space ---- Start here! ![adobe-express-qr-code (2)](https://hackmd.io/_uploads/B1wuPWMhT.png) ---- Create your first notebook: ![image](https://hackmd.io/_uploads/HybpDZf2p.png) Call it `GDG GenAI by Elemento`! ---- Embrace the power of GPUs: ![image](https://hackmd.io/_uploads/SyT-dZfnp.png) ---- Select Nvidia T4: ![image](https://hackmd.io/_uploads/r1EX_WG3T.png) and save! ---- # 🊄ðŸ’ŧ ## Let's start the ~~hacking~~ spellcasting! ---- # ðŸ”Ū ### Summoning Spells #### Installing the Fooocus Enchantment Invoke the powers of Fooocus with a simple Git spell. Create a code line and type: ```bash !sudo apt update && sudo apt install git ``` ---- Clone the Fooocus git repository locally bypassing again python: ```bash !git clone https://github.com/lllyasviel/Fooocus.git ``` ---- Install a single python package manually: ```bash !apt install python3.10-venv ``` ---- Let's move to the Fooocus directory. Using `%` you can ask Colab to change the `workdir`. ```bash %cd Fooocus ``` As a confirmation you'll get: ``` /content/Fooocus ``` --- # ðŸ“Ķ ## Kickstart Fooocus #### Channeling Your Generative Magic Let's set it up: it will take some time! ``` !python3 -m venv fooocus_env && source fooocus_env/bin/activate && pip install -r requirements_versions.txt ``` --- # ðŸŠķ ## Wingardium leviosa! #### Make it fly Launch Fooocus by typing: ```bash !source fooocus_env/bin/activate && python entry_with_update.py ``` ---- # ☕ïļ It will download ~7GB of AI models. Take a coffee! ---- Fooocus can automatically use `gradio.io` to become reachable from the outer world. The current runtime is only reachable on localhost: ![image](https://hackmd.io/_uploads/B1Ez6Wz3p.png) ---- Fooocus provides many options on where to publish the web interface: 1. no option: listens on localhost (127.0.0.1) 1. `--listen` listens on local LAN 2. `--share` opens a proxy on gradio.io ---- Stop and edit the command cell as follows and run it again: ```bash !source fooocus_env/bin/activate && python entry_with_update.py --share ``` ---- You'll find the URL to open your web UI in the output lines! ![image](https://hackmd.io/_uploads/r1i7Abzna.png) --- # ðŸŽĻ ## Illuminating Artistry #### Channeling Your Generative Magic ---- ![Screenshot 2024-02-20 at 12.39.27-min](https://hackmd.io/_uploads/rkzp1Mz2a.png) --- # 🚀 ## Conclusion #### Soaring High on the Wings of AI Creativity - Embrace the **free** potential of Google Colab! - Hack it to the max: bypass python to get the real underlying power. - Ride the currents of GPU power and scale your magic to new heights. ---- <img height="300px" src="https://hackmd.io/_uploads/BJo8-fM2p.png"> Looking for more power? https://fooocus.elemento.cloud
{"title":"Unleashing the Power of Google Colab for Generative AI ðŸ’ŧðŸŽĻ","description":"Dive into the magic of Python, from scripting to powerful packages.","contributors":"[{\"id\":\"4e2bc6f4-f901-4289-9d6d-1bdec59bd8c6\",\"add\":5528,\"del\":1677}]"}
    221 views
   Owned this note