The most likely cause is a sleep disorder. It is called a "rapid eye movement" disorder in dogs because that is the part of the sleep cycle in which the disorder occurs. When she is attacking you, part of her brain is turned off so she does not know what she is doing. Dogs with this problem, can be very aggressive, and bite, when woken up.
During dreaming, the brain is electrically very active This includes the portion of the brain that controls movement. During this stage of sleep, a region in the brain stem actively paralyzes motor neurons to prevent that activity in the motor center from causing movement. The exception to this are the motor neurons that control breathing and eye movements. That's why you see the rapid eye movement (REM) during certain stages of sleep. In some patients, this active paralysis of motor neurons fails. This results in excessive, sometimes violent motor activity during dreaming. In some cases this is associated with vocalizations such as growling and even biting/attacking movements. The dog is basically acting out his dreams.
The main risk is the dog hurts themselves or hurts anyone or anybody nearby. Management consists of having the dog sleep in a confined, well-padded area, such as a crate to prevent any injury.
There are two medications, clonazepam and bromide, that can be used to treat it. Your vet can prescribe those medications for you.
Seizure activity can cause this type of behavior as well.
If it is seizure activity, you can not wake the dog up during a seizure.
If you google "REM sleep disorder" you can see some videos, on YouTube, of dogs and people with this problem which may help you tell the difference.
You will need to video tape a couple of episodes so your vet can see what is going on and to help your determine the cause as well as a treatment.
Your vet will want to do blood work, and a urinalysis, to make sure there is not an underlying medical cause as well.
I hope this helps.
If you have additional questions, please click "reply."