If your employment is at will then you cannot be prevented from terminating your employment...at will.
There is a strong probability your employment has been misclassified as an independent contractor rather than an employee.
From the facts you provide, it is unclear if you have an an employment agreement or a services contract.
If you are an employee, you can quit anytime you like, though your employment agreement may contain disincentives if you don't complete the two year term (such as a requirement that you repay training costs or a forfeiture of severance, etc.).
If you are an independent contractor, with a services contract, your services contract may contain penalties for early termination.
I strongly suggest that you consult with an experienced labor and employment attorney and allow the attorney to review your written agreement. That attorney will then be able to advise you on any potential penalties for terminating your agreement earlier than the two year term.
Your question has been answered as a courtesy. This is not paid legal advice. Nothing in this communication is intended to create an attorney-client relationship. Unless expressly stated otherwise, nothing contained in this message should be construed as a digital or electronic signature, nor is it intended to reflect an intention to make an agreement by electronic means.