Categories
Machine Learning

Upgrade AUTOMATIC1111 StableDiffusion Torch 2.0 and Xformers Linux

The default installation of Stable Diffusion Automatic111 using the old version of Torch 1.13.1, Torchvision 0.14, and related Xformers, the webui.sh will receive “No module ‘xformers’. Proceeding without it.”.

Pytorch 2.0 and Xformers are offering a big upgrade. Here are quick step on how to upgrade the Automatic111 web UI and load with xformers.

If you are using Anaconda, go open its terminal then go to stable-diffusion-webui/venv/bin and source activate to enter “venv” environment with python 3.10 as default.

Then, we can start to upgrade the torchvision, torch and xformers with this command

pip install torchvision --upgrade
pip install torch==2.0
pip install -U xformers

If receive an error like this, you can upgrade the torchvision version.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchvision 0.14.1+cu117 requires torch==1.13.1, but you have torch 2.0.0 which is incompatible.
Successfully installed torch-2.0.0

After everything is done completely, you can fire-up your webui.sh along with xformers module loaded with command : “bash webui.sh –xformers”

Categories
Networking

Migrate WordPress to Upgraded Ubuntu AWS Server

I move WordPress from Ubuntu Server 21.04 to 23.04 with several easy steps. Here are the quick guideline on how to migrate WordPress safely without breaking

First, Backup all necessary data
Open your terminal and start with your home path ~/

sudo mysqldump -u root -p yourdb > db.sql

Second, Compress etc, home and any folder needed

sudo zip -r /etc etc.zip
sudo zip -r /home/ubuntu

Transfer the file to the new server. If you need to use pem-key and using either windows or linux, use SCP to transfer pem-key from local computer to old-server. This is needed so you can transfer file from old to new server

scp -i .\your-key.pem -r .\your-key.pem ubuntu@your-ec2-server-ip:/home/ubuntu

Now your key pem is exists in home path in old server. Its time to transfer the whole zip files backup to the new server home path

scp -i your-key.pem *.zip ubuntu@your-new-server-EC2:/home/ubuntu/

Once its done, you just need to extract the folder and replace whatever needed configuration and databases to the new server.

If you encountered by permission denied (13) on NGINX,

/php/php8.0-fpm.sock:", host: "www. com"
2023/04/23 16:31:33 [crit] 17224#17224: *28 stat() "/home/ubuntu/" failed (13: Permission denied), client: 182.253.152.107, server: .com, request: "GET / HTTP/1.1", host: "www. .com"
2023/04/23 16:31:33 [crit] 17224#17224: *28 stat() "/home/ubuntu/" failed (13: Permission denied), client: 182.253.152.107, server: .com, request: "GET / HTTP/1.1", host: "www..com"
2023/04/23 16:31:33 [error] 17224#17224: *28 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 182.25352.107, server: .com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "www..com"

the quickfix solution

sudo gpasswd -a www-data ubuntu
chmod o+x YOUR-WEBSITE-FOLDER
sudo service php8.1-fpm restart
sudo service nginx restart

Done! Now you can smoothly migrate WordPress from the old ubuntu server to the new ubuntu server without problem. The last step is to change the IP-address in NS. If you are using AWS Route 53, just change the IP address in the record and you are ready to go!

Categories
Windows

Solve Profile PS1 cannot be loaded UnauthorizedAccess

If you have this error when opening CMD, Powershell or terminal

WindowsPowerShell\profile.ps1 cannot be loaded because running scripts is disabled on
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ . 'C:\Users\dev\Documents\WindowsPowerShell\profile.ps1'
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

The quick fix is open “Powershell” with administrator access and execute this command

Set-ExecutionPolicy Unrestricted
Categories
Anaconda

Conda without Python in Windows 11

When using Anaconda conda in terminal Windows, we often found the Python and default packages is already installed. To create conda new environment empty packages in Windows cmd / powershell without any packages, follow this steps:

  1. Uninstall Anaconda (if you have its installed)
  2. In installation step, un-check both “Add Anaconda to my Path” and “Register Anaconda Python for VScode, etc.”
  3. Complete the installation
  4. Go to Edit the Environment Variables
  5. Create a new variable with “C:\Users\YOURUSERNAME\anaconda3\Scripts”

And we done. Next, you can open terminal:

conda init
conda create -n test
conda activate test
conda list

Voilla! Now you have empty environment with Conda 100%!

Categories
Deep Learning

Install Tensorflow GPU in Jupyter Notebook Windows

Note:

Please go to the latest update article here https://www.yodiw.com/fix-install-tensorflow-2-with-gpu-simple-version-2023/

Author

Jupyter Notebook from Anaconda is not coming with Tensorflow by default. If you are using Windows and want to leverage your GPU (mine is RTX 3060Ti), you can install Tensorflow GPU integrated with your Jupyter.

In this steps, no Python installation required, since we will using Python from Anaconda (~ version 3.9). This is also to reduce complexity of using different virtual environment in Conda.

Yes, in this step, the TensorFlow will automatically load into your default Jupyter root base environment and will not require installing a new one.

Categories
Windows

Enforce Dark mode to all website in Chrome

Dark mode is good or bad for your eyes? What happen when all website you are visit is in Dark mode? I’m running this experiments via Chrome. Yes, you can enable this easily. Follow the steps below

First, type this into your browser

chrome://flags

Search “auto dark mode” in the search box, then click Enable.

Then relaunch your browser. Now, everything you see will be in dark mode!


PS: Apparently dark mode is not good for my eyes focus after give a try for 15-20 minutes
Categories
Windows

Fix Customize resolution unable Nvidia Samsung 240hz

When I’m using 240hz with G-SYNC and Performing scaling on GPU, the resolution available is just 5120xs1440, 1920×1440, 1920×1200, and 1600×1200.

To add new resolution, here are the pre-requisities: Make sure enable 240hz and Scaling on GPU

Then go to regedit, choose “Find” with Key and value checked, enter keyword “nv_modes”.

Modify by adding this as end of the line

2560x1439x8,16,32,64=1F;3440x1440x8,16,32,64=1F;

Then reboot. Now you should see a new resolution in your Nvidia Panel

Categories
Windows

Fix GPU load 100% Desktop Window Manager Windows 11

When your PC feels laggy with Nvidia GPU drivers that keep hitting 100% under idle situations, there are several chances to cause that problem.

Either its virus, trojan on mining crypto, the NVIDIA drivers mismatch, misconfiguration on NVidia settings, Windows scaling issues and many more

After tweaking several stuff, I gave up and decided to solve this by revert back to Windows 10 with NVCleanStall. There result is amazing, now my GPU load RTX 3060 Ti is back to normal

Ideally, when your Windows is idle, your GPU load utilization should be like this

Fyi, this is running under 240hz of monitor refresh rate and using Windows 11 22H2

To solve the problem:

  1. Reduce performance by go to Windows start menu “Adjust the appearance and performance of windows”.
  2. Try to remove unnecessary animation and others stuff.

3. Install the latest Nvidia drivers and do not change the
4. Go to Task Manager, find Desktop Window Manager, right click and choose “Go to Details”. Find dwm.exe and right click. Set priority to Normal.

If the GPU load still high, Please check your Nvidia settings and change Power Management from “Prefer Maximum Performance” into “Normal” then reboot.

If this High GPU load still exists, the last resort is to “uninstall your GPU Nvidia Driver” and use the default driver from Windows (early version)

In my case, the 2021 drivers works like a charm for me!

Categories
Machine Learning

Install Tensorflow run with GPU RTX in Windows 11

Note:

Please go to the latest update article here https://www.yodiw.com/fix-install-tensorflow-2-with-gpu-simple-version-2023/

Author

This tutorial will help you to run Tensorflow in Windows 11 to use GPU for modelling, with the latest Visual Studio, CUDA and latest drivers. In this case, I’m using RTX 3060Ti Lite Hashes and Python 3.7 – 3.10 for Windows. (I use Python 3.10.9)

TLDR;

We need to install

  • Clean Windows Installation and GPU drivers card
  • the Microsoft Visual C++ (MSVC) compiler 2022
  • the CUDA Toolkit 11.8
  • the cuDNN libraries
  • Install tensorflow

Pre-requisites

1. Windows fresh installation to remove the complexity of issues or bugs is recommended here. I did re-install my Windows 11 in this step

2. Instead of using Nvidia Geforce Experience, I uninstall the GPU drivers (back to Microsoft Basic) and use NVCleanstall to download my RTX 3060 drivers without others bloatware https://www.techpowerup.com/download/techpowerup-nvcleanstall/

3. I use Python 3.9 from Anaconda https://www.anaconda.com/products/distribution

Categories
Uncategorized

Install Windows 11 22 H2 Without Internet

The quick fix, press Shift + F10 in wireless page and type

OOBE\BYPASSNRO