<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paco Vega on Medium]]></title>
        <description><![CDATA[Stories by Paco Vega on Medium]]></description>
        <link>https://medium.com/@fvegasepu?source=rss-df6ddfa602e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vKYe2VZbv-MdBPkR</url>
            <title>Stories by Paco Vega on Medium</title>
            <link>https://medium.com/@fvegasepu?source=rss-df6ddfa602e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:12:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fvegasepu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploying ALIA (the Spanish LLM model) in OCI Data Science]]></title>
            <link>https://medium.com/@fvegasepu/deploying-alia-the-spanish-llm-model-in-oci-data-science-4c6ac1590e5b?source=rss-df6ddfa602e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c6ac1590e5b</guid>
            <dc:creator><![CDATA[Paco Vega]]></dc:creator>
            <pubDate>Fri, 11 Apr 2025 09:11:34 GMT</pubDate>
            <atom:updated>2025-04-11T10:31:23.071Z</atom:updated>
            <content:encoded><![CDATA[<p>Each week there is news about different models, like the recent anouncement of Deepseek or the newest version of ChatGPT. On January 20th 2025, Pedro Sanchez, president of Spain, presented <strong>ALIA - </strong>the new AI Spanish model. The model has been trained in the super computer center in Barcelona (BSC-CNS).</p><p>Although the model is still in the middle of its training phase, a version has been published on Hugging Face. In this article, I’m going to tell you how to deploy it over OCI Data Science platform through the Quick Actions. These steps are valid to this or any other model you want to deploy.</p><h3>Hugging Face</h3><p>You can find the model <a href="https://huggingface.co/BSC-LT/ALIA-40b">here</a>. To download it, we need to have a registered user in Hugging Face. In addition to this, we will need to have a token with <em>write </em>permissions. To find out the token go to <strong>Profile &gt; Settings &gt; Access Token &gt; Create New Access Token. </strong>Copy the generated token and store it for later use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*K_vTfHInP8TnmS65.png" /></figure><h3>Requirements</h3><p>The first step will be to create a compartment in OCI, I have called it ALIA. We will also need to create a bucket, inside object storage, where the model will be downloaded once we have registered. It is mandatory to check the <strong>Object Versioning</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*g7OZMESuUN5pUrFa.png" /></figure><h3>OCI permissions</h3><p>It is necessary to create dynamic groups and policies to accomplish the deployments.</p><h4>Dynamic groups</h4><p><strong>Alia-dynamic-group</strong></p><pre>any {all {resource.type=&#39;datasciencenotebooksession&#39;, resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}, all {resource.type=&#39;datasciencemodeldeployment&#39;,resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}, all {resource.type=&#39;datasciencejobrun&#39;, resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}}</pre><p><strong>Alia-training-job-runs</strong></p><pre>any {all {resource.type=&#39;datasciencejobrun&#39;, resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}}</pre><h4>Policies</h4><p><strong>Alia-policies</strong></p><pre>Allow dynamic-group alia-dynamic-group to manage data-science-model-deployments in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-models in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to use logging-family in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-jobs in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-job-runs in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to use virtual-network-family in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to read resource-availability in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-projects in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-notebook-sessions in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-modelversionsets in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to read buckets in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to read objectstorage-namespaces in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to inspect compartments in tenancy<br>Allow dynamic-group alia-dynamic-group to manage object-family in compartment &lt;your-compartment-name&gt; where any {target.bucket.name=&#39;&lt;your-bucket-name&gt;&#39;}<br>Allow dynamic-group &lt;dynamic-group-name&gt; to read repos in compartment &lt;your-compartment-name&gt; where any {request.operation=&#39;ReadDockerRepositoryMetadata&#39;,request.operation=&#39;ReadDockerRepositoryManifest&#39;,request.operation=&#39;PullDockerLayer&#39;}</pre><p><strong>Alia-job-policies</strong></p><pre>Allow dynamic-group alia-training-job-runs to use logging-family in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-training-job-runs to manage data-science-models in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-training-job-runs to read data-science-jobs in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-training-job-runs to manage objects in compartment &lt;your-compartment-name&gt; where any {target.bucket.name=&#39;&lt;your-bucket-name&gt;&#39;}<br>Allow dynamic-group alia-training-job-runs to read buckets in compartment &lt;your-compa</pre><h3>Data Science in OCI</h3><h4>Deploying Data Science Project</h4><p>The next step is the creation of the Data Science project in OCI. We are going to call it ALIA DS PROJECT. To do so, under <strong>Analytics and AI, </strong>click on <strong>Data Science</strong>, then <strong>Create Project</strong>. Ensure you create it in the right compartment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ZvmBNV4TLAUa-n5R.png" /></figure><p>Once the project has been created, click on <strong>Create notebook session.</strong> During the creation of the notebook, we have to take into account several things:</p><ul><li>It is important to select a big enought storage due to the size of the LLM models. They are usually quite large(&gt; 75 GB in this case).</li><li>Add an Object Storage mount point, we may need it later.</li><li>It won’t be necessary to select a GPU shape at this moment. The notebook itself won’t be the one executing the model.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*G6LmKUI2GCOTf-G7.png" /></figure><h4>Access the Data Science platform</h4><p>Once the notebook is enabled, a button labeled as <strong>Open </strong>will be activated. Click on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*yUIyumoe-b2RvgZS.png" /></figure><p>Open a Terminal on this screen and type the following commands in order to log in to Hugging Face with the token we created before. Our token will be autmatically registered and stored in the Notebook’s cache. After that, we will be ready to register the model.</p><pre>(base) bash-4.4$ huggingface-cli login<br><br>    _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|<br>    _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|<br>    _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|<br>    _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|<br>    _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|<br><br>    To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .<br>Enter your token (input will not be visible): <br>Add token as git credential? (Y/n) nb<br>Token is valid (permission: fineGrained).<br>The token `datascience` has been saved to /home/datascience/.cache/huggingface/stored_tokens<br>Your token has been saved to /home/datascience/.cache/huggingface/token<br>Login successful.<br>The current active token is: `datascience`<br>(base) bash-4.4$</pre><h4>Registering the model</h4><p>Click on <strong>AI quick actions </strong>icon and then click on <strong>Register new model.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*knAi--TJ5aOco092.png" /></figure><p>On the register screen, from the dropdown list, select <strong>Download from Hugging face. </strong>As it is not one of the pre-verified models, click on <strong>Register any Model </strong>and search for the model <strong>BSC-LI/ALIA-40B. </strong>Finally, select the bucket that we created before and write a path where the model will be stored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*inRZ0GDEwPBdp0We.png" /></figure><p>You will see a screen showing the download progress and its subsequent upload to the bucket. This may take a while, have a cup of coffee.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*E6F_nbSyYNOY7fwq.png" /></figure><h4>Deploy the model</h4><p>Our model has been sucessfully registered. You can find it now in the <strong>Model explorer</strong> inside <strong>Quick Actions</strong> menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*RVSMOWX9SLx_n5bI.png" /></figure><p>Double click on the model name and we will be ready for deployment. Here is where you should select the appropriate GPU. A dropdown list of the available shapes will be displayed. In this case, I have chosen a BM.GPU.4.8. This means 8xA100 40Gb of vRAM each NVIDA GPUs. This may take a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*5-ztqKqU_jPaGoUD.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fCwtswAdasSdX4N9.png" /></figure><p>Finally, we will have our model registered and deployed and we will be able to test it, using the <strong>Endpoint </strong>or inside the console.</p><h4>Invoking your model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zNhEVaz-VIG8Ev-N.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*i8yG1lnUw8Ye-XQ5.png" /></figure><p>By clicking on the <strong>Invoking your model </strong>link you could see several ways of invoking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*T9EIWj8iKfTemDTW.png" /></figure><p>In the following example you can see how the model is invoked from Langchain using streamlit.</p><pre>import streamlit as st<br><br>from langchain_community.llms.oci_data_science_model_deployment_endpoint import OCIModelDeploymentLLM<br>import oci<br># authentication configured<br><br>#In this demo we will explore using Streamlit to input a question to llm and display the response<br><br>#Step 1 - authenticate using &quot;DEFAULT&quot; profile<br><br>compartment_id = &quot;ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;<br>CONFIG_PROFILE = &quot;DEFAULT&quot;<br>config = oci.config.from_file(&#39;~/.oci/config&#39;, CONFIG_PROFILE)<br><br>#Step 2 - setup OCI Generative AI llm<br><br># Service endpoint<br>endpoint = &quot;https://modeldeployment.eu-frankfurt-1.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.eu-frankfurt-1.xxxxxxxxx/predict&quot;<br><br>llm = OCIModelDeploymentLLM(<br>    model=&quot;odsc-llm&quot;,<br>    endpoint=&quot;https://modeldeployment.eu-frankfurt-1.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.eu-frankfurt-1.xxxxxxx/predict&quot;,<br>    model_kwargs={<br>        &quot;max_tokens&quot;: 500,<br>        &quot;temperature&quot;: 0.7,<br>        &quot;top_k&quot;: 50,<br>        &quot;top_p&quot;: 0.99,<br>        &quot;frequency_penalty&quot;: 0,<br>        &quot;presence_penalty&quot;: 0<br>    }<br>)<br><br><br>#Step 3 - we define a function to return response<br><br>def generate_response(input_text):<br>  st.info(llm(input_text))<br><br>#Step 4 - here we write a quick streamlit application that accepts text input (question) and<br># on clicking a &#39;submit button call a function that generates response<br><br>st.title(&#39;🦜🔗 Welcome to the Alia ChatBot in OCI &#39;)<br>with st.form(&#39;my_form&#39;):<br>  text = st.text_area(&#39;Enter text:&#39;, &#39;Pregunta aquí lo que quieras a tu chat bot&#39;)<br>  submitted = st.form_submit_button(&#39;Submit&#39;)<br>  if submitted :<br>    generate_response(text)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*noUZ9G4LKBN8s52C.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c6ac1590e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying ComfyUI over GPU on OCI (English Version)]]></title>
            <link>https://medium.com/@fvegasepu/deploying-comfyui-over-gpu-on-oci-english-version-26da8f78ba1f?source=rss-df6ddfa602e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/26da8f78ba1f</guid>
            <dc:creator><![CDATA[Paco Vega]]></dc:creator>
            <pubDate>Wed, 26 Mar 2025 12:53:55 GMT</pubDate>
            <atom:updated>2025-04-01T08:45:12.195Z</atom:updated>
            <content:encoded><![CDATA[<p>As you may know we can deploy different AI models in OCI using the Data Science, as I explained <a href="https://medium.com/@fvegasepu/desplegando-alia-el-llm-espa%C3%B1ol-en-el-data-science-de-oci-2ced86380edd">here</a>.</p><p>But you can also deploy your models using open source. In case of image generation models, <strong>ComfyUI </strong>has become the most popular open source, node-based program that allows users to generate images using <strong>prompts</strong> and <strong>diffusion models </strong>such as Stable Diffusion, Flux or others.</p><p>In this post I’m going to explain the steps to deploy it from scratch.</p><h3>Request Service Limits updates</h3><p>If you haven’t used GPU on OCI before, you may need to increase your service limits. On help icon click <strong>Request a service limit increase. </strong>The Support chat will be opened, and you may click on <strong>Limit Increase</strong> button. Once you are in the limit updates screen, select <strong>Compute </strong>as category and select the right shape for the GPU you are going to need (In this example, we use <strong>GPUs for GPU A10 based VM and BM instances)</strong> and increase the number, write a justification and click on <strong>Create Support Request</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t6zKFUE05C82PL67H432sA.png" /></figure><h3>Creating the GPU compute</h3><p>To create the GPU compute, we should go to <strong>Compute </strong>&gt; <strong>Instances</strong> click on <strong>Create Instance</strong>. Put a friendly name, select the right compartment where you want to create the new compute. Go to I<strong>mage and shape</strong> section and click on <strong>Change Shape.</strong> Here you may choose <strong>Specialty and Previous Generation </strong>in order to select a GPU shape. In this example, we select <strong>VM.GPU.A10.1</strong> which is the smallest GPU shape available in OCI. You can find the list of shapes VM <a href="https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm#vm-gpu">here </a>BM <a href="https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm#bm-gpu">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fxDre8lsaP3T3fVarES6A.png" /></figure><p>You may then select the right image. Ensure you select one with GPU support. We have used <strong>Oracle Linux 8</strong> in this example. You can find the list of images <a href="https://docs.oracle.com/en-us/iaas/Content/Compute/References/images.htm">here</a>, select the ones with a note like this: “<em>x86 shapes and GPU shapes are supported with this image</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ch6q-NZYVHrTaixQ_Nrf2w.png" /></figure><p>In the <strong>Add SSH key</strong> section, use the auto generated keys or upload your own public key.</p><p>Finally, in the <strong>Boot Volume</strong> section, click on <strong>Specify a custom boot volume size</strong>. Keep in mind the models can be quite large, so increase the size to at least 500 GB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0NXoqJ8idIB-QWT8RMKzA.png" /></figure><p>Just click on <strong>Create </strong>to finish the creation of the compute.</p><h3>Increase the size of the volume in linux</h3><p>As I just said, we had to select a volume for the machine that is big enough, but when you log in into the machine you won’t see the space of the disk. So, follow these steps to increase the size on Linux.</p><pre># Displays the disk space usage and file system information in human-readable format.<br>df -h  <br># Provides detailed information about each logical volume in the system.<br>sudo lvdisplay  <br><br># Displays the attributes and free space of the volume group.<br>sudo vgdisplay  <br># Lists block devices with detailed information.<br>sudo lsblk -d -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL  <br># Prints the free space on the specified disk.<br>sudo parted /dev/sda print free  <br># Resizes the third partition on the disk to occupy 100% of the free space.<br>sudo parted /dev/sda resizepart 3 100%  <br># Resizes the physical volume to match the underlying disk partition.<br>sudo pvresize /dev/sda3  <br># Extends the logical volume to use all available free space.<br>sudolvextend -l +100%FREE /dev/ocivolume/root  <br># Grows the XFS file system to use all available space on the root partition.<br>sudo xfs_growfs /  <br><br># Verify the changes<br>df -h </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*rSXtFnmuOvRFGcXVLehzDg.png" /></figure><h3>Install the required software and setting up python</h3><p>Execute the following command</p><pre>sudo dnf install wget git git-lfs jq python3.11 python3.11-devel.x86_64 python3.11-tkinter libsndfile rustc cargo unzip zip -y</pre><p>Package explanations:</p><ul><li>wget: A command-line utility for downloading files from the web.</li><li>git: A popular version control system used for managing source code.</li><li>git-lfs: Git Large File Storage, an extension for Git to handle large files efficiently.</li><li>jq: A lightweight and flexible command-line JSON processor.</li><li>python3.11: The Python programming language, version 3.11.</li><li>python3.11-devel.x86_64: Development files and headers for Python 3.11.</li><li>python3.11-tkinter: Tkinter, a GUI toolkit for Python.</li><li>libsndfile: A library for reading and writing various audio file formats.</li><li>rustc: The Rust compiler.</li><li>cargo: The Rust package manager and build system.</li><li>unzip: A utility to extract compressed files in ZIP format.</li><li>zip: A utility to create and manipulate ZIP archives.</li></ul><p>The next steps will be to select the desired Python 3 version as the default one. To do so:</p><pre># This command installs a symbolic link at /usr/bin/python3 pointing to /usr/bin/python3.11.<br>sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11<br><br>sudo update-alternatives --config python3<br><br># check the vesrion <br>python --version </pre><h3>Installing and setting up ComfyUI</h3><p>Run the git clone to download and install ComfyUI</p><pre>git clone https://github.com/comfyanonymous/ComfyUI</pre><p>After installing ComfyUI, I suggest installing some custom nodes that will provide extra features for ComfyUI. On the folder you’ve just downloaded ComfyUI, move to the <strong><em>custom_nodes</em></strong> folder and run the following.</p><pre>git clone https://github.com/ltdrdata/ComfyUI-Manager<br>git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes<br>git clone https://github.com/rgthree/rgthree-comfy<br>git clone https://github.com/WASasquatch/was-node-suite-comfyui<br>git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes<br>git clone https://github.com/cubiq/ComfyUI_essentials<br>git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus<br>git clone https://github.com/evanspearman/ComfyMath<br>git clone https://github.com/chflame163/ComfyUI_LayerStyle<br>git clone https://github.com/BlenderNeko/ComfyUI_Noise<br>git clone https://github.com/kijai/ComfyUI-KJNodes<br>git clone https://github.com/kijai/ComfyUI-Florence2<br>git clone https://github.com/ALatentPlace/ComfyUI_yanc <br>git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts <br>git clone https://github.com/WASasquatch/was-node-suite-comfyui <br>git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack</pre><p>The most important custom node is the <strong>ComfyUI Manager</strong>. This extension provides a comprehensive management suite, allowing you to easily install, remove, disable, and enable custom nodes within ComfyUI, as well as a centralized hub and convenient access to a broad range of information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TiVLmcZMb6c_1RCE.jpg" /></figure><p>We will also need to install the required libraries and the requirements from ComfyUI itself, as well some other extra useful libraries.</p><pre>pip install -r requirements.txt  <br>pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121 <br>pip install numba opencv-python matplotlib timm accelerate</pre><h3>Running ComfyUI</h3><p>Before running ComfyUI, you must add the right IPs and ports to the security list, specifically port 8188, which will be used for this application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YCK6a5qK1b7-IFWaVDaSAg.png" /></figure><p>In addition to adding the port to the security list, you may also need to configure the VM’s firewall to allow incoming traffic on port 8188.</p><pre>sudo firewall-cmd --permanent --zone=public --add-port=8188/tcp<br>sudo firewall-cmd --reload</pre><p>To launch ComfyUI, navigate to the installation folder and run the following command.</p><pre>python main.py --listen=0.0.0.0 --port=8188</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYbiUUyh0wBUiJ5dlmuQXA.png" /></figure><h3><strong>Downloading and installing models in ComfyUI</strong></h3><h4>Hugging Face Token</h4><p>We are going to need to have a user account in <a href="https://huggingface.co/">Hugging Face</a>, and we will also require Bearer Token with write permissions. We will use this token later.</p><h4>Installing model via command line</h4><p>In the following example, we download and install <a href="https://huggingface.co/black-forest-labs/FLUX.1-dev">Flux1-dev, </a>which is a model for image generation.</p><pre>cd /home/$USER/ComfyUI/models/unet<br>wget --header=&#39;Authorization: Bearer hf_mytoken&#39;  https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.safetensors<br>cd /home/$USER/ComfyUI/models/clip<br>wget --header=&#39;Authorization: Bearer hf_mytoken&#39;  https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors<br>wget --header=&#39;Authorization: Bearer hf_mytoken&#39;  https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors<br>cd /home/$USER/ComfyUI/models/vae<br>wget --header=&#39;Authorization: Bearer hf_mytoken&#39;   https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors</pre><h4>Installing models from ComfyUI Manager</h4><p>Click on the Manager &gt; Model Manager, and then search for the model you want to use. Click on install. Once the model is installed, ComfyUI will prompt you to restart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8KxikQN-9aNGNxc19mAI6A.png" /></figure><p>To wrap up this post, here you have some examples of images generated using ComfyUI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*p_3B-dp0aEMkY1MqnJqxYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*JcXMp7CpIbmFC9JynZ67pg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*VgSB9EZyhxUFEfjWHcn81w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26da8f78ba1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Desplegando Alia (el LLM español ) en el Data Science de OCI]]></title>
            <link>https://medium.com/@fvegasepu/desplegando-alia-el-llm-espa%C3%B1ol-en-el-data-science-de-oci-2ced86380edd?source=rss-df6ddfa602e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ced86380edd</guid>
            <category><![CDATA[oci]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[gpu]]></category>
            <dc:creator><![CDATA[Paco Vega]]></dc:creator>
            <pubDate>Tue, 04 Feb 2025 16:26:18 GMT</pubDate>
            <atom:updated>2025-02-07T09:04:40.322Z</atom:updated>
            <content:encoded><![CDATA[<p>Nos despertamos a diario con la publicación de nuevos modelos de IA como la reciente irrupción de Deepseek. El paso 20 de enero el presidente del gobierno Pedro Sánchez presento <strong>ALIA </strong>“el modelo funcional de inteligencia artificial (IA) en español”. El modelo ha sido entrenado en el centro de super computación de Barcelona (BSC-CNS).</p><p>Aunque el modelo aun esta en una fase intermedia de su entrenamiento en este articulo voy a explicar como podemos desplegar dicho modelo en un <strong>Data Science</strong> de <strong>Oracle </strong>usando las <strong>Quick Actions.</strong></p><p><strong>Hugging Face</strong></p><p>El modelo se encuentra publicado <a href="https://huggingface.co/BSC-LT/ALIA-40b">aquí </a>y por tanto vamos a necesitar tener un usuario de Hugging face para poder registrar y descargar el modelo. Así mismo debemos crear un token con permisos de escritura. Lo encontraremos dentro del <strong>Profile &gt; Settings &gt; Access Token &gt; Create New Access Token. </strong>Copiaremos y guardaremos dicho token en nuestra herramienta de gestion de claves favorita o en un txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*84sr4Nmb4kwpYQ_BCahTOA.png" /></figure><p><strong>Requisitos Previos</strong></p><p>Lo primero que haremos será crear un compartment para este despliegue, en mi caso lo he llamado ALIA. Además crearemos un bucket que será donde se acabara descargando nuestro modelo cuando lo registremos. Es necesario que dicho bucket tenga activado el versionado.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*wl2v9cPmbXlayR3r_PivPg.png" /></figure><p><strong>Gestion de permisos en OCI</strong></p><p>Tras ellos debemos crear los dynamic group y policies necesarias para tener los permisos necesarios para llevar a cabo este despliegue.</p><p><strong>Alia-dynamic-group</strong></p><pre>any {all {resource.type=&#39;datasciencenotebooksession&#39;, resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}, all {resource.type=&#39;datasciencemodeldeployment&#39;,resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}, all {resource.type=&#39;datasciencejobrun&#39;, resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}}</pre><p><strong>Alia-training-job-runs</strong></p><pre>any {all {resource.type=&#39;datasciencejobrun&#39;, resource.compartment.id=&#39;&lt;your_compartment_ocid&gt;&#39;}}</pre><p>Y las políticas para dichos grupos :</p><p><strong>Alia-policies</strong></p><pre>Allow dynamic-group alia-dynamic-group to manage data-science-model-deployments in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-models in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to use logging-family in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-jobs in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-job-runs in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to use virtual-network-family in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to read resource-availability in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-projects in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-notebook-sessions in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to manage data-science-modelversionsets in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to read buckets in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to read objectstorage-namespaces in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-dynamic-group to inspect compartments in tenancy<br>Allow dynamic-group alia-dynamic-group to manage object-family in compartment &lt;your-compartment-name&gt; where any {target.bucket.name=&#39;&lt;your-bucket-name&gt;&#39;}<br>Allow dynamic-group &lt;dynamic-group-name&gt; to read repos in compartment &lt;your-compartment-name&gt; where any {request.operation=&#39;ReadDockerRepositoryMetadata&#39;,request.operation=&#39;ReadDockerRepositoryManifest&#39;,request.operation=&#39;PullDockerLayer&#39;}</pre><p><strong>Alia-job-policies</strong></p><pre>Allow dynamic-group alia-training-job-runs to use logging-family in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-training-job-runs to manage data-science-models in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-training-job-runs to read data-science-jobs in compartment &lt;your-compartment-name&gt;<br>Allow dynamic-group alia-training-job-runs to manage objects in compartment &lt;your-compartment-name&gt; where any {target.bucket.name=&#39;&lt;your-bucket-name&gt;&#39;}<br>Allow dynamic-group alia-training-job-runs to read buckets in compartment &lt;your-compartment-name&gt; where any {target.bucket.name=&#39;&lt;your-bucket-name&gt;&#39;}</pre><p><strong>Creación del proyecto de Data Science en OCI</strong></p><p>El siguiente paso será la creación de un proyecto de Data Science en OCI, lo vamos a llamar ALIA DS PROJECT y estará dentro de nuestro compartment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CF4cs3Tj2Q2ibZhybLmicQ.png" /></figure><p>Una vez dentro del proyecto crearemos un Notebook, es importante seleccionar un almacenamiento grande para este tipo de Notebooks ya que los modelos a descargar son pesados (En el caso que nos ocupa &gt; 75 Gb). Además debemos añadir el Mount point de Object Storage en caso de necesitarlo. En este punto no será necesario añadir GPUs ni una máquina especialmente potente ya que no será esta máquina la que ejecute nuestro modelo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vhBOX2yCi78wHqx7A8sIyQ.png" /></figure><p><strong>Acceso al Data Science</strong></p><p>Pulsando el botón de <strong>Open </strong>accederemos al Data Science una vez aquí abriremos un terminal para hacer login a Hugging face con el token que guardamos antes. Nuestro token quedará registrado y activo en la cache del Notebook. Tras esto ya podemos proceder a registrar el modelo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*n6fGHy5Mdpla6bhotT04Bg.png" /></figure><pre>(base) bash-4.4$ huggingface-cli login<br><br>    _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|<br>    _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|<br>    _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|<br>    _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|<br>    _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|<br><br>    To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .<br>Enter your token (input will not be visible): <br>Add token as git credential? (Y/n) nb<br>Token is valid (permission: fineGrained).<br>The token `datascience` has been saved to /home/datascience/.cache/huggingface/stored_tokens<br>Your token has been saved to /home/datascience/.cache/huggingface/token<br>Login successful.<br>The current active token is: `datascience`<br>(base) bash-4.4$</pre><p><strong>Registro del modelo</strong></p><p>Pulsamos en AI quick actions y le damos a registrar un nuevo modelo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*onXT3milAaKpBM1--kvDUg.png" /></figure><p>En la pantalla de registro elegimos la opción Download from Hugging Face y <strong>Register any model</strong>. en el model name buscamos por el nombre del modelo “<strong>BSC-LT/ALIA-40b</strong>” y elegimos el bucket que creamos al principio para registrar el modelo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*GB1WKVs4akztHN_Qz6apMA.png" /></figure><p>Aparecerá una pantalla donde veremos la progresión de la descarga del modelo y su posterior subida al bucket. Esto puede tardar un rato, ve a por un café.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Bj7YB0Wnbpiv0WUOJWGOWA.png" /></figure><p>Nuestro modelo ya esta registrado, y aparcera en la lista de modelos seleccionables dentro de nuestro Quick Actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*oDmtOAn7YRvOwpddfbBHIw.png" /></figure><p>Pulsamos en el modelo y ya estaremos listos para hacer el despliegue. Eligiendo la GPU o GPUs en la que lo queremos desplegar. En este caso hemos elegido una BM.GPU4.8 que es una Bare Metal con <strong>8xA100 </strong>de 40 GB de vRAM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*q8i9nHaTTEV0a058sV8FDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*euHoXhDRNbq_aK6q6D8SzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d4wd9ZFNvUGqICECjQVlvg.png" /></figure><p>Una vez desplegado podemos probar el modelo desde la propia consola o con el <strong>Endpoint</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MsTabegY_i1mutHT1TdGpw.png" /></figure><p>Haciendo click en <strong>Invoke your model</strong> podéis ver ejemplos de como llamar al modelo por http o con OCI CLI o por ejemplo usando langchain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FA2hHQs2_2E20ydnAA4OJA.png" /></figure><p>Ejemplo de despliegue en LangChain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*J8jOMJJ0QsiP4SasCV-70Q.png" /></figure><pre>import streamlit as st<br><br>from langchain_community.llms.oci_data_science_model_deployment_endpoint import OCIModelDeploymentLLM<br>import oci<br># authentication configured<br><br>#In this demo we will explore using Streamlit to input a question to llm and display the response<br><br>#Step 1 - authenticate using &quot;DEFAULT&quot; profile<br><br>compartment_id = &quot;ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;<br>CONFIG_PROFILE = &quot;DEFAULT&quot;<br>config = oci.config.from_file(&#39;~/.oci/config&#39;, CONFIG_PROFILE)<br><br>#Step 2 - setup OCI Generative AI llm<br><br># Service endpoint<br>endpoint = &quot;https://modeldeployment.eu-frankfurt-1.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.eu-frankfurt-1.xxxxxxxxx/predict&quot;<br><br>llm = OCIModelDeploymentLLM(<br>    model=&quot;odsc-llm&quot;,<br>    endpoint=&quot;https://modeldeployment.eu-frankfurt-1.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.eu-frankfurt-1.xxxxxxx/predict&quot;,<br>    model_kwargs={<br>        &quot;max_tokens&quot;: 500,<br>        &quot;temperature&quot;: 0.7,<br>        &quot;top_k&quot;: 50,<br>        &quot;top_p&quot;: 0.99,<br>        &quot;frequency_penalty&quot;: 0,<br>        &quot;presence_penalty&quot;: 0<br>    }<br>)<br><br><br>#Step 3 - we define a function to return response<br><br>def generate_response(input_text):<br>  st.info(llm(input_text))<br><br>#Step 4 - here we write a quick streamlit application that accepts text input (question) and<br># on clicking a &#39;submit button call a function that generates response<br><br>st.title(&#39;🦜🔗 Welcome to the Alia ChatBot in OCI &#39;)<br>with st.form(&#39;my_form&#39;):<br>  text = st.text_area(&#39;Enter text:&#39;, &#39;Pregunta aquí lo que quieras a tu chat bot&#39;)<br>  submitted = st.form_submit_button(&#39;Submit&#39;)<br>  if submitted :<br>    generate_response(text)</pre><p>Este es solo un ejemplo, pero como veis se puede desplegar cualquier modelo de forma rápida en el Data Science.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ced86380edd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Select AI con OCI Generative AI]]></title>
            <link>https://medium.com/@fvegasepu/select-ai-con-oci-generative-ai-de112e0c3cd5?source=rss-df6ddfa602e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/de112e0c3cd5</guid>
            <category><![CDATA[cohere]]></category>
            <category><![CDATA[autonomous-database]]></category>
            <category><![CDATA[select-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[oci]]></category>
            <dc:creator><![CDATA[Paco Vega]]></dc:creator>
            <pubDate>Thu, 04 Apr 2024 14:35:39 GMT</pubDate>
            <atom:updated>2024-04-04T14:35:39.478Z</atom:updated>
            <content:encoded><![CDATA[<p>Desde 2023 la base de datos autónoma permite hacer consultas con lenguaje natural a la misma. Para poder interpretar el lenguaje natural Select AI puede hacer usos de distintos LLM (Large Language Models) :</p><ul><li>OpenAI</li><li>Cohere</li><li>Llama2</li><li>Oracle Gen AI</li></ul><p>En este post vamos a hablar de esta última. Para esta demo voy a hacer uso del schema <a href="https://docs.oracle.com/en/database/oracle/oracle-database/19/comsc/installing-sample-schemas.html#GUID-1E645D09-F91F-4BA6-A286-57C5EC66321D">HR </a>clásico de Oracle.</p><p>Lo primero que deberemos hacer será <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/sql-generation-ai-autonomous.html#GUID-7B6A819E-AF51-445B-949D-E8E16A936CFE">crear un profile </a>para hacer uso de una de estos LLM. En este caso vamos a usar las credenciales del <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/resource-principal.html#GUID-E283804C-F266-4DFB-A9CF-B098A21E496A">resource principal</a> de OCI.</p><p>En el profile se han de añadir la lista de objectos (tablas) que queremos que se tengan en cuenta en nuestras consultas con lenguaje natural.</p><pre>BEGIN             <br><br>     -- drops the profile if it already exists<br>    DBMS_CLOUD_AI.drop_profile(<br>            profile_name =&gt; &#39;GENAI&#39;,<br>            force =&gt; true<br>    );                  <br> <br>  DBMS_CLOUD_AI.CREATE_PROFILE(                                              <br>      &#39;GENAI&#39;,                                                             <br>      &#39;{&quot;provider&quot;: &quot;oci&quot;,                                                                   <br>          &quot;credential_name&quot;:&quot;OCI$RESOURCE_PRINCIPAL&quot;,                             <br>       &quot;object_list&quot;: [{    {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;countries&quot;},<br>                            {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;departments&quot;},<br>                            {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;employees&quot;},<br>                            {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;jobs&quot;},<br>                            {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;jobs_history&quot;},<br>                            {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;locations&quot;},<br>                            {&quot;owner&quot;: &quot;HR&quot;, &quot;name&quot;: &quot;regions&quot;}<br>                            ]             <br>       }&#39;);                                                                  <br>END;  </pre><p>Para poder empezar a usarlo debemos de cargar el profile</p><pre>BEGIN<br>    DBMS_CLOUD_AI.SET_PROFILE(profile_name =&gt; &#39;GENAI&#39;);<br>END;</pre><p>En el momento de escribir estas líneas SelecAI todavía no esta soportado usando el Database Actions o el servicio de APEX. Por lo tanto usa tu ID favorito. El mío es el <a href="https://www.oracle.com/database/sqldeveloper/technologies/download/">SQL Developer</a>.</p><p>Con Select AI nos da 4 opciones:</p><ul><li>Hacer un promt con lenguaje natura y que la base de datos ejecute las SQL necesarias y devuelva los resultados (<strong>runsql</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*IhKPpI8cpUGdALPcpzToww.png" /></figure><ul><li>Con ese mismo promt obtener la SQL generada (<strong>showsql</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*Xzqtd7Spx2RPcWJ1bG7KbQ.png" /></figure><ul><li>Explicar como ha generado ese SQL (<strong>explainsql</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*plwzXcXm5ODJOlB8Y5ePHQ.png" /></figure><ul><li>Que ese promt nos de una respuesta descriptiva de esos mismos datos (<strong>narrate</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*SAdP1BxAl-Fvm1xT1x_s-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*6lmNK9QVFcoQdDOLTo-_gA.png" /></figure><ul><li>O una respuesta de tipo chatbot (<strong>chat</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*jH9jTy6IWqCpYdqM08JPvg.png" /></figure><p>Si quieres saber más o probarlo tu mismo te recomiendo este <a href="https://oracle-livelabs.github.io/adb/shared/adb-speaks-human/workshops/tenancy/index.html">livelab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de112e0c3cd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>