Having agreed to sign a lease and to take on lease obligations, you have legal responsibilities. Your co-tenant may have been depending on you to share the rent. The landlord was expecting full rent. Assuming that you signed the lease, and agreed to be responsible for the rental obligations (including rent), you cannot force the landlord to take your name off the lease until the lease expires. You also cannot force your co-tenant to pay the full rent (with no reimbursement from you) even though your co-tenant now has full run of the house. You can however find a replacement for you and propose that your co-tenant and the landlord accept the replacement in your stead. The landlord and/or your co-tenant may accept the replacement but insist that you be a guarantor for the replacement. Alternatively, you may be able to negotiate a fixed payment to extract a release. Simply put, there are two negotiations to extract you fully from the lease -- one with the landlord and one with your co-tenant.
If you moved out as part of an agreement with your roommate, you should ask them to sign an agreement that they will agree to take responsibility for the lease terms since they are going to be having the use of the apartment for the remainder of the lease term. Such an agreement would prevent your former roommate from seeking payment from you for any part of the rent you had originally agreed to pay when you signed the lease.
With respect to the landlord, an agreement with your roommate will not remove your liability to the landlord if the rent isn't paid. You would have to get a separate agreement from the landlord to release you from the lease -- and the landlord has no reason to want to do that. It can't hurt to ask, however.
If you don't get an agreement from the roommate and/or the landlord, then you don't have any legal right not to pay the rent. You signed the lease. Your best bet if you cannot live out the lease is to work out as good an agreement as you can with your roommate and the landlord.
I concur with the advice above.
As a general matter, when you sign the lease you are agreeing to pay the rent for the term of the lease. You would need the landlord to sign a document releasing you from the lease in order to not be liable for rent.
Disclaimer: This answer is for informational purposes only and should not be treated as legal advice. This answer does not create an attorney-client relationship.