Droid equipment is much less bad than you'd think; the armors, while not upgradable, are some of the best in the game with massive damage resistances, and upgraded pistols are extremely potent, rivaling lightsabers with high-level gear. I've used the following on HK-47 in the HK Factory:
Armor: Droid Agrinium Armor - this piece of armor gives 50% Energy resistance and 50% Fire resistance. Pretty much the whole HK Factory deals Energy damage, so equipping it halves all damage you take right off the bat.
Weapons: dual wielding Mandalorian Disintegrators with the best anti-droid upgrades you can get: Ion Charger Mark V, Mandalorian Chamber Mark III, either Accuracy Scope or Pinpoint Scope depending on whether you could use higher Attack or benefit from the Keen critical range increase more - if you're missing enemies with the Keen upgrade, take the +4 Attack scope, otherwise go for Keen.
Master Sniper Shot for damage - this is why Mandalorian Disintegrators are the best blaster pistol in the game. Their damage is slightly lower than Micro-Pulse Blaster, but they have a critical range of 18-20 as opposed to 20-20 for the Micro-Pulse Blaster and other heavy blasters. (Lightsabers, for comparison, have a critical range of 19-20). With Master Sniper Shot, the range is quadrupled to a whopping 9-20 (7-20 with a scope giving it the Keen property), allowing you to get critical hits more than half the time. Ion Charger Mark V has a Massive Criticals bonus, further boosting the damage output of critical hits. Additionally, HK's Assassination Protocols special feat gives a chance to chop a portion of the enemy's HP right out on a critical hit if they fail a saving throw - with a Sniper Shot set-up, this bonus activates quite often.
With a set-up like this, you hit twice per round with dual pistols while critically hitting 1-2 times every time for ~180 damage per round on average (from memory; the exact numbers might be different), which is enough to kill HK-50s in the Factory in 2-3 rounds as Hassat Hunter said. Agrinium Armor doesn't make you completely invincible, but it is enough to keep you going for every fight except for the giant showdown at the end of the Factory, where you may need to kite them or use Shields and Repair Kits to make it through.
If you don't have Mandalorian Disintegrators (they are a high-level drop, and you need to be min-maxing your levels to get them, most likely), Mandalorian Rippers are a lower-damage alternative with an equivalent critical range (most of the damage of blasters comes from upgrades, so the lower base damage isn't that big of a deal). Micro-Pulse Blasters with a Master Rapid Shot set-up instead of a critical-hit focused one can also work if you lack Disintegrators or didn't build your HK for Sniper Shot, but Mandalorian Disintegrators with a Sniper Shot set-up blow them out of the water from my experience.
For Feats, you should have Master Two-Handed and Master Sniper Shot, with the rest dumped into Precise Shot, the feat that gives your ranged attacks a flat +10 damage bonus at rank V - HK-47 has a very slow feat progression, so don't waste your feats on anything else since losing out on higher levels of Precise Shot will cut your damage significantly. You can also get a Dexterity upgrade for HK-47 from Goto's Ship, and M4-78 also has upgrades for him as HH mentioned. You should NOT invest into Blaster Pistol Specialization, since the best head-slot upgrade in the game (Droid Warfare Upgrade) gives you that feat for free, letting you put more points into Precise Shot.