Tencent Cloud HAI: Everyone can paint with AI without any threshold!

Table of contents

  • Preface
  • About HAI
  • Advantages of HAI
  • Enable HAI usage
  • Clean up resources
  • Experience
  • Conclusion
  • references

Preface

With the continuous advancement of technology and the arrival of the data-driven era, more and more developers and data researchers require powerful computing power to support their work, especially when processing large-scale data, performing machine learning and artificial intelligence, etc. In terms of high-performance applications, the demand for GPU computing power is becoming more and more urgent. As a developer, I think that as the field of artificial intelligence continues to be hot, more and more high-performance applications will be born. These high-performance applications are based on powerful data and computing power processing. Although there are also Domestic and foreign Internet companies are gradually launching their own GPU computing services. However, after experiencing some well-known GPU computing services, I personally feel that the high-performance application services launched by Tencent Cloud are good. I feel that this service is tailor-made for developers. A GPU cloud service platform that requires no complex configuration and is ready to use. So this article will share in detail the author’s personal experience process and what I gained from using it.

About HAI

First, let’s take a look at the product introduction of Tencent Cloud HAI. According to Tencent Cloud’s official introduction, Tencent Cloud High-Performance Application Service (Hyper Application Inventor, HAI) is a GPU application service product for AI and scientific computing. It provides developers with The Pengpai computing power platform is tailor-made to ensure that users get the best value for money. Without complicated configuration, you can enjoy the out-of-the-box GPU cloud service experience.

In HAI, users can intelligently match and select the most suitable GPU computing resources according to the application, thereby ensuring the best cost performance in high-performance applications such as data science, LLM (Large Language Model), and AI painting. Moreover, HAI's The one-click deployment feature allows users to build application environments for popular models such as StableDiffusion and ChatGLM in just a few minutes. For AI researchers, the intuitive graphical interface will greatly reduce the complexity of debugging, and it supports multiple connection methods such as jupyterlab and webui, helping developers easily explore and innovate. Even just open the browser and HAI will open. Endless possibilities for high-performance application areas!

In addition, the application scenarios of HAI are introduced. In fact, AI painting is a drawing method that uses deep learning algorithms to create creations. It is widely used in digital media, games, animation, movies, advertising and other fields. It will be reflected in the specific usage links below.

Advantages of HAI

According to the official introduction of Tencent Cloud, the core concept of HAI is to provide surging computing power to meet the needs of developers and data scientists in various high-performance applications. Whether it is data science, LLM or AI painting, HAI can be based on The needs of the application are intelligently matched and the most suitable GPU computing resources are recommended. This allows developers to no longer need to worry about the configuration and management of computing resources, so they can focus on application development and optimization and improve work efficiency. In addition, HAI has many advantages, such as ease of use, rapid deployment, flexibility, and rich types of computing power.

1. Simple and easy to use

The preparation before use is very simple, simplifying the configuration process of storage and other infrastructure, greatly reducing the complexity of operation and maintenance management, and it is really simple and easy to use.

2. Rapid deployment capability

HAI's one-click deployment feature makes it possible for users to build application environments for popular models in a few minutes. For example, the one-click deployment feature of popular models such as StableDiffusion and ChatGLM on the HAI platform allows users to quickly build application environments for these models, saving money. This eliminates the cumbersome configuration process, which greatly reduces the time and cost of application deployment, and supports the rapid deployment of multiple AI environments.

3. Strong flexibility

HAI supports users' ability to log in to instances, and can also configure AI models and instance environments very flexibly, which greatly facilitates users' needs for complex actual situations, especially to meet many practical application scenarios.

4. Rich types of computing power

It is reported that HAI provides a variety of computing power packages for users to choose from. Users can choose the appropriate computing power package based on the HAI service details and their actual business needs, and HAI is constantly updating this type of computing power to meet the needs to the greatest extent possible. Use in various practical scenarios.

Enable HAI usage

Without too much nonsense, let’s start directly with the highlight of this article, about the use of HAI. Before officially starting to use HAI, some preparations need to be carried out. After the preparations are completed, the actual operation experience can be carried out.

1. Preparatory work

Regarding the issue of Tencent Cloud account, this article will not go into details. Let me just talk about it here. After logging in with a Tencent Cloud account, open the home page of HAI.

After logging in to your account, you need to apply for qualifications.

After logging in to your Tencent Cloud account, if it has not been activated, directly click the Apply for Qualifications button.

Then go to the application details page and fill in the basic information. The specific actual projects are as shown below:

After submitting the application, make sure it is correct, and then enter from the console.

If the application qualifications have not been approved, you will be prompted with this message:

When the application is in progress, the HAI console will display the following picture:

After successfully applying for qualifications, you will first receive a text message reminder, and then go to the console to enter, and you need to sign another consent authorization.

After the application is successful, sign the agreement.

After agreeing to the authorization, enter the computing power management console.

Then go to create a new computing power, as shown below:

Then enter the new purchase page, as shown below:

Here, in order to operate and use HAI to easily control AI painting, I chose the following services:

After the purchase is successful, you need to wait for a short time.

After the creation is successful, the specific details will be displayed, as shown below:

Click on the computing power list to enter details, as shown below:

2. Use HAI to conduct Vincent diagram model

You can directly enter the computing power control interface, 5 days of annual leave, and ask for leave on Sundays. There are two ways to enter.

Entry method one:

Entry method two:

After entering, open the control interface, as shown below:

First, let’s Chineseize it. Use the StableDiffusionWebUI deployed by High-Performance Application Service HAI to configure the Simplified Chinese language package.

After localization, you need to load it in the Extension tab to install it directly from the plug-in list. And the Extension tab can be installed directly by loading the official plug-in list. The Extension tab can be installed directly by loading the official plug-in list.

Then click, as shown below:

There will be many results. Because there is too much data, you can use the ctrl+f shortcut key to directly search for zh_CN, then you can find it and click to install, as shown in the following figure:

The effect when searching:

After the installation is successful, you will be prompted below that the Chinese function has been installed.

Then save the settings as follows:

What needs to be noted here is that after setting up, you must save the settings first and then restart, otherwise it will have no effect. As follows:

If there is still no change after saving the settings, restart it twice more and the localization will be successful. I restarted 3 times before the localization was successful. The effect after Chineseization is as follows:

In addition, I need to share the extension functions, as shown below:

3. Concrete experience

Next is the highlight, a quick AI painting experience, directly setting the parameters, as shown below:

正向参数:a beauty girl, 25 years old, with big eyes, melon seed face, willow eyebrows, double eyelids, long black hair, graceful figure, gentle and elegant, tall

反向参数:(deformed,distorted,disfigured:1.0),poorly drawn,bad anatomy,wrong anatomy,extra limb,missing limb,floating limbs,(mutated hands and fingers:1.5),disconnected limbs,mutation,mutated,ugly,disgusting,blurry,amputation,flowers,Non human,man,animal

Next is the moment to witness the miracle, click the generate button in the upper right corner

A short wait is required, as shown below:

The generated effect is as follows. Here I generated 2 pictures, as shown below:

Effect picture one:

Effect picture two:

Download and save the AI ​​painting image generated above, as shown below:

4. StableDiffusion API service usage

Next, let’s experience the high-performance application service HAI to quickly provide developers with StableDiffusion API services. Then enter the jupyter_lab operation interface and find the corresponding place in the Tencent Cloud console. Here is the selection on the computing power management page.

After entering jupyter_lab, as shown below:

Select terminal operation, as shown in the figure below:

Enter the command line in the terminal:

cd /root/stable-diffusion-webui python launch.py --nowebui --xformers --opt-split-attention --listen --port 7862

The specific execution results are as follows:

The effect after executing the command is as follows:

Next, you need to add the port configuration of the high-performance application service HAI so that the external network can smoothly access the API service provided by the server and experience its use. Enter the computing power details and click Edit Rules.

Then enter the computing power details and find the corresponding security group rule settings, as shown below:

Next, let’s look at the configuration reference as follows:

Source: 0.0.0.0/0 Protocol port: TCP:7862 (fill in according to the port you configured)

The specific configuration location is as follows. It is worth noting that this is just a personal record of one's own use. If there are any differences, please refer to the actual situation.

Once created, the list will be displayed as follows:

Open the StableDiffusion API interface usage guide. After the configuration is completed, enter the server IP address: port number/docs to view the relevant API interface swagger usage guide. There are several commonly used official APIs:

/sdapi/v1/txt2img Text and image POST

/sdapi/v1/img2img Picture generation POST

/sdapi/v1/options Get settings GET | Update settings POST (can be used to update remote models)

/sdapi/v1/sd-models Get all models GET

The server address here is the public IP of the computing power you have activated. If you are not sure, you can go to the computing power details to view it. I will not go into details here. Enter the server address + port number + /docs in the browser and press Enter to open it, as shown below:

5. Build Web applications

Use the StableDiffusion API built by High Performance Application Service HAI as the server to quickly develop a web application based on Cloud Studio. Enter Cloud Studio in the search box and click Search, as shown below:

After entering, select the development space, as shown below:

Select Create manually and create it now as shown below:

Enter the manual creation page and set up the new workspace, as shown in the figure:

After creating a new one, wait for a while and the creation will be successful, as shown below:

The front-end interface has been completed. Please download the compressed package and upload it to the workspace and decompress the compressed package. Click to download the compressed package: sd_api.zip  Download link:Login- Gitee.com

Then upload the compressed package, see the diagram below for details:

Click on the blank space and click the upload button directly to upload successfully.

Upload the compressed package as follows:

Terminal operation to decompress the compressed package:

Enter the decompression command in the terminal:

unzip sd_api.zip

Enter the decompression command in the terminal and the file will be opened:

After decompression is complete, it looks as follows:

Then start the web service and view the page to be debugged. After decompression is complete, enter the command in the terminal window:

cd sd_api #Enter the folder

npm install #Install dependency packages

Then enter the project (sd_api) and install the dependencies and start the Web project screenshot:

After waiting for the dependencies to be installed, you can start the web project and enter the command:

npm run dev #Start web

Start the project and the effect after running is as follows:

View the web page by viewing the port as shown below:

Select local preview to see the effect, as shown below:

Then set it up, then compose it.

Create a file named Txt2ImgModel.ts in the model folder under the Vue project. This file is mainly used to call related interface parameter configurations, as shown below:

Then create a file named ControlNetModel.ts in the model folder under the Vue project. This file is mainly used to add the ControlNet component.

Next install the vue environment as follows:

After the installation is complete, download the attachment main.zip, unzip it, and overwrite the main.vue file to main.vue in the views folder under the project and save it. This file will be used for data binding and image rendering functions:

Download code file: main.vue.zip, Download link: https://gitee .com/mmliujc/tencent_gpu/raw/master/main.zip,Screenshot of the main.vue file in the view folder after modification:

At the same time, modify the vite.config file under the vue project, and modify the configuration information to the relevant information deployed in the high-performance application HAI server API. The main thing is to modify the access server address, as shown below:

Then after saving, re-run the project as follows:

After the construction is completed, quickly start the web page and test it. The effect is as follows:

Clean up resources

If you are only using it for trial use, it is recommended to clean up the resources after use to avoid excessive waste of money. However, if it is necessary to use it, it is not recommended to clean up resources, so you must be cautious.

1. Clean up the workspace created in online Cloud Studio

Return to the Cloud Studio configuration interface, select the development space, stop the currently running space and then delete it.

After stopping, you can directly click the "Delete" button on the far right, as shown below:

2. Destroy the high-performance application service HAI in the console 

Find the created HAI service, then enter the computing power management page, click Destroy, and select Confirm to destroy it.

Experience

Through the above personal experience of HAI, combined with the use of other related products and services in the actual development process, I personally experienced the unique excellent performance and convenience of HAI, because before using HAI, I had to purchase and configure expensive GPU servers. , it consumes a lot of time and energy, but through the experience of using HAI, I found that everything becomes simple and efficient, especially it only takes a few minutes for me to start the GPU instance I need, and there is no need to worry about hardware failure or maintenance, etc. question.

Through horizontal comparison, I feel that the intelligent matching computing power provided by HAI also ensures the best cost performance, which is unmatched by other similar products! There is also the one-click deployment feature of HAI, which is very useful for application environments that quickly build models, especially when configuring and deploying popular models locally. Since the traditional method has complex dependencies and environment configuration, this process is very time-consuming. Sometimes it's easy to make mistakes. So on HAI, I can quickly set up the model application environment I need with just a few clicks, allowing me to focus more on model development and experimentation, which is great!

Conclusion

Through the above introduction to Tencent Cloud HAI, and my personal experience of HAI's painting function, I am very satisfied with the experience of using HAI. It not only allows me to have a deeper understanding of computing power and generative AI, but also gives me the following Practical use at work brings great inspiration. Tencent Cloud HAI is a powerful computing power platform for developers. It provides developers with a powerful GPU cloud service experience. It does not require complex configuration and has the advantages of rapid construction, making HAI better used by developers from all walks of life. Whether it is for data researchers, machine learning engineers, or other developers who need high-performance computing, HAI is a powerful and easy-to-use option. Finally, I appeal to all my fellow developers. If you are a developer who needs strong computing power support, I strongly recommend you to try Tencent Cloud’s high-performance application service HAI. I believe it will bring you a surprising experience. !

references

1. Tencent Cloud HAI High-performance application service HAI new product internal testing

Guess you like

Origin blog.csdn.net/CC1991_/article/details/134343108