This is insane isn't it.
I had a library of some 12,000 songs before joining Apple Music, now everything is duplicated. I have duplicate playlists, I have duplicate songs.
Most of the duplicate playlists are empty. Some have maybe a couple of songs in them that are in the original playlist. I went ahead and tidied up the empty playlists and everything was looking good. However I then tried what was suggested on this page Duplicate songs in iTunes - Apple Community and signed out and back in to my account in the Music App (MacOS Sonoma) and have now lost nearly all my playlists - some of this stuff is unrecoverable and consists of set-lists for bands I play in and took a long time to compile, covering many years of my musical life. As far as I can tell, this is now all gone. I'll have to root through my Time Machine backups and see what I can recover.
However, still, when I ask it to show duplicates it shows 22,897 songs (yeah, an odd number! Hey, maybe there's ONE that isn't duplicated... ).
I have absolutely no idea how to fix this. Just to give an idea of the scale of destruction, here's a random snapshot of a part of my library...
Starting to remember why I ditched Apple Music years ago, but I love the streaming quality and when the integration with my own library works, it's great, hence why I returned.
I need a way out of this :(