No Title
If you apply in EB-1 category as an outstanding researcher, and the job qualifications would not be contingent on your graduation from the residency, then you can process GC while in the residency.
Otherwise, you have to meet the requirements for the job through which you are applying for the GC. Which typically means that you must have graduated from the residency program at the time of application for Labor Certification or I-140 (for NIW).
The friend of mine is currently finishing his residency in H-1 status, and his future employer already started advertisements in preparation for filing of RIR Labor Certification upon his graduation.
Hope this helps.