Mastodon Politics, Power, and Science

Wednesday, August 2, 2023

AI Is changing fast.

 Just the last couple weeks several huge open source releases of chat and image generation AI happened,  ARM IPO is blowing up based on their future role in AI, AMD chips that support AI were released,  and Nvidia announced the release of a ground breaking release of a new image generation technology called Perfusion.  

It is an exciting time to be alive.  It is almost a full time job to try to just skim the headlines. 

This week I finally wrote my own little neural net to recognize the hand written characters of the MNIST data set.  I followed a tutorial for python that only used the matrix library numpy and coded up a 2 layer neural net.  I watched a few other videos as well.  Planning on picking up a copy of Neural Nets from Scratch, it looks like a great book.  

My plan this week is to build a tiny c library to implement a neural net object.  Combined with a few other small c libraries that implement ai, and running all the different tasks cooperatively, at the same time, this kind of tech could be ground breaking.   If a small, inexpensive arm chip was created that had dedicated ai acceleration built in and a library like this supported that chip then that could be an amazing reference system that could change the world.

A small library that implemented general neural nets, generate stories, speak, can turn speech into text, and has a layer to manage all that could revolutionize drones, robotics, toys, security systems ( with a visual ai), and just about any technology we use today.  A door bell or answering machine could call screen for you.  Imagine a thermostat that actually was intelligent. 

I think Christmas in 2 years is going to see a toy that isn't powered by AI is going to be a toy that no kid wants.  There won't be an alarm clock, door bell, weather station, thermostat or other small consumer good that isn't intelligent.  

A year after that every medical device is going to be smart.  A blood pressure cuff that knows more about reading blood pressure than any human is a game changer.  

Monday, July 31, 2023

Fix the worlds electrical systems.

 

There are four main areas that need fixed. 

1. The main grid.

   The main grid needs to be beefed up to carry power from areas that have a surplus to areas that are lacking power.  We need to switch to super conductors in downtown metro areas for efficiency.

   There is also the fact that our electric grid is very vulnerable to emp and solar flares.  We need a method of disconnecting the wires of the main grid from the big transformers to protect them from these effects.  

    We also need backups of the big transformers in distributed warehouses ready to be deployed in hours to fix a burned out system.  Right now it would take years to build and deliver these transformers if they were damaged by a catastrophic event. 

2. Upgrade houses to be smart homes.

   Appliances should be smart and connect to the houses control unit.  This control unit should schedule when things run to reduce the demand that is being placed on the electrical grid.  So the fridge doesn't run at the same time as the ac unit.  The control unit should limit the draw of the entire house to no more than 20 amps.  Battery packs should be charged at night, or charged from the home grid in the day.  If electrical power is used to heat water, this should be done at night.  If done correctly this staging and running of appliances could reduce power needs of households in America by a factor of 5.

3. Switch to solar power, wind power, and water power.

    If your house needs more than 20 amp service, or when the main grid is out then you should be able to switch to batteries at your own home that are charged with locally produced solar, wind, and water power.  A 10KW solar panel on every's roof with a wind turbine for windy conditions would be enough to charge these batteries, come wind or shine.

    And here is where the beefed up grid from step one comes into play.  When the main grid senses a lack of power in one area it should signal other areas and they put power from their batteries or from their solar/wind/water power sources back onto the grid.  Imagine west coast helping out the east coast in the morning and then the east coast helping out the west coast later as the heat peaks in the west.

   The power system could keep track of home much power you add to the grid and how much you take from the grid and charge you for the power you used minus the power you added.  Plus a flat rate to maintain the power grid. 

4. Stop using carbon to heat water.  

    Heating water is 1/6 the energy use in every single home in America.  Switch to solar water heaters to heat water.  You could build tubing into the back of every solar panel and use that to both cool the panel and heat antifreeze. This warm antifreeze could then be put through a small bank of high temp vacuum tubes with reflectors to focus the heat on nickel coated copper tubes to get the temps up to nearly boiling.  Then run this heated antifreeze through tubes in a 500 gallon water tank to store the heat.  A small solar panel could run the pumps for this system, the intensity of the sun on the solar panel being all that is needed to regulate the speed of the liquid through the system.  Heavy bags of paraffine that each have a different melting point could be used to store heat in their phase change of switching between solid and liquid states. Like heat storing batteries. 

    If you need to use electrical power to heat the water, then would only be allowed to happen at night, when there is a surplus.  You could use your own electrical power anytime during the day, say after you reach full charge on the batteries.  Any wind power needs a   The houses controller could mange this to keep the water up to temp while using a minimum of grid power.

  This tank could be used for hot water for the sinks and shower. It could also be used to heat a loop of antifreeze that runs under the floors of the perimeter of the house and holds most of the cold at bay.  A loop of this heated water could be put under the floor in the bathroom for toasty warm floors all the time there. 


Tuesday, July 25, 2023

How to build a neural net from scratch in python.

 Found a very good video with sample code.  Very easy to understand how this works.  Only uses the numpy linear array library.  


https://www.youtube.com/watch?v=w8yWXqWQYmU

https://www.kaggle.com/code/wwsalmon/simple-mnist-nn-from-scratch-numpy-no-tf-keras/notebook


Here is a screen shot of one of the test runs and some code.




Weekly ai update


This week I upgraded to the uncensored 7b version of the newly released Llama 2 chatbot ai model.

https://huggingface.co/TheBloke/llama2_7b_chat_uncensored-GGML/tree/main

I run it with llama.cpp :

https://github.com/ggerganov/llama.cpp

I finished putting thumbnails on all my lora and, ti, and checkpoints. I actually found 2 hypernetworks and tried both of them out yesterday and today. gothicRPG_ArtStyle_v1 and IncaseStyle_AnythingV3, but I used it with Anything V5.

Tried out sd upscale but it didn't work for me. Downloaded and installed the Ultimate SD upscale to try it out.

I installed a couple of extensions to automatic1111 that control the aspect ration better. I found an extension that shows the images and and lets you look through everything you have generated easily called, "infinite image browsing."

Found the smallest ai program that uses modern techniques that can run fast on very small computers. I could see just about everyone releasing intelligent devices with $5 computers installed that can talk and listen and tell stories. Crazy how fast ai is moving to the slowest and cheapest computers. It is being called baby llama.

https://github.com/karpathy/llama2.c

The code that performs the magic is less than 500 lines. One of the really cool pieces of code that I had not seen before is the following code before a for loop:

#pragma omp parallel for

This is clever and elegant because if you don't give the flag and library at compile time, the compiler just ignores it, allowing your code to be really simple. But if you compile it with the flags -fopenmp -lomp then those for loops are magically multithreaded and run many times faster than they would otherwise. Planning on rebuilding a bunch of my old code and see how much faster I can make it.

Tiny c based ai program

 Can run fast on just about any hardware above an 8 bit microcontroller.  Amazing how fast this ai stuff is going to the smallest levels. Easy to understand.  Imagine a little robot teddy bear that whose mouth moved as it told stories and talked to a kid. And never told the same story twice. Imagine it could teach the alphabet one letter a day by telling stories that feature characters whose names started with that letter.  A is for ant, b is for bumble bee, c is for cat, d is for dog, and so on. 

Astounding.


https://github.com/karpathy/llama2.c

sd upscale in the img2img tab

 Stable diffusion has a really cool tool called sd upscale that will rescale an image using an ai, then breaks an image up into tiles and runs img2img on those smaller tiles.  This allows you to upscale well beyond any limits you have in memory. The only tradeoff is that each time you double the size of an image, it takes 4 times longer to double another time.

You can find this option by going to the img2img tab in automatic1111, click on scripts at the bottom of the page and select sd upscale.  

You want to set the cfg scale and sampling steps high, and set the denoise strength low. Change your prompt to just "highly detailed."  Play with this to get the effect you want.  

By setting the denise strength a little higher and using a prompt like leaf for an image of leaves you can create an image of a leaf made up of tiles of little leaves. 


Monday, July 24, 2023

Found the deep fake extension.

 I found the roop deepfake extension in stable diffusion.  It works so great that it is astounding.  This is me as a dwarf, an elf, a hobbit, a barbarian, and as an old man. 










Player Portal in Mega Mappers

Codex Engine: Player Portal, Auth, Rules-as-MCP & AI NPCs (Pure Node-Tree Edition) Defining game rulesets (D&D 5e, Pathfinder, Cyber...