mirror of
https://github.com/SillyTavern/SillyTavern-Extras.git
synced 2026-10-15 18:11:52 +00:00
[GH-ISSUE #199] talkinghead: how to get manual poser working? #121
Labels
No labels
bug
duplicate
planned
pull-request
under consideration
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SillyTavern/SillyTavern-Extras#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Technologicat on GitHub (Dec 13, 2023).
Original GitHub issue: https://github.com/SillyTavern/SillyTavern-Extras/issues/199
I'd like to produce static expression images using this, but I'm having trouble running the manual poser app.
extrasconda venv activated when I run this.The manual poser seems to expect a
live2dfolder; is live2d a dependency, or is a blank folder enough? By a quick look in the source code, this doesn't seem to be actually used except as a target directory. So, I created a blanktalkinghead/live2dfolder.Running
python -m tha3.app.manual_poser, in a terminal at thetalkingheadtop-level folder, the manual poser application starts up.Note that the manual says to instead use
python tha3/app/manual_poser.py, but this doesn't work. The app crashes upon startup, becausesys.pathdiffers from what imports in the app expect. When running with-m, the cwd is added tosys.path, so that looking up modules liketha3.poserortha3.utilworks (when we invoke thepython -m ...command in the folder that contains thetha3folder).But with the latter option (running a
.pyfile, not a module), it is the script's containing folder, i.e. thetha3/appfolder, that is added tosys.path. Then trying to look up modules in a module path beginning withtha3will not work, since the top level is already attha3.app. (Relative imports wouldn't work, either, because in this mode the main script is not treated as a module - yeah, Python's import system can be confusing.)Anyway, this way I got the app to start, and the window appeared, but I still couldn't get it to do anything.
Loading an image to test with (e.g.
talkinghead/tha3/images/example.png), the app raises the following exception:Note the path.
The file
tha3/models/separable_float/eyebrow_decomposer.ptdoes exist (I've actually installed the full model package mentioned in the manual), but we're already running this insidetalkinghead.Trying to run the manual poser from the top-level SillyTavern-extras folder as
python -m talkinghead.tha3.app.manual_poserdoes not work either, because then the module paths will be wrong again.Any ideas?
EDIT: Note that the live mode of talkinghead is working fine; it's only the manual poser app I'm having trouble with.
@Technologicat commented on GitHub (Dec 14, 2023):
A quick look at the source code shows that this comes from the loaders in
talkinghead/tha3/poser/modes/.The call sequence is as follows:
talkinghead/tha3/app/manual_poser.pycallstha3.poser.modes.load_poser"separable_float", so this dispatches totha3.poser.modes.separable_float.create_poser. The function is called with no arguments other thandevice, so it uses its default configuration.The
create_poserfunction has the following default directory that is used in its file paths:This will trigger an exception much later, when trying to use the model and the file is not found at the expected path.
But since the live mode is working fine, and it runs with a different cwd (the top level of SillyTavern-extras), I'd wager the default directory should not be changed.
Maybe the easiest solution is to just adapt the imports in the manual poser, so that we could run both apps from the top level of SillyTavern-extras?
EDIT: Meh, just changing the imports in
manual_poser.pytofrom talkinghead.tha3...doesn't work - thentalkinghead/tha3/poser/modes/load_poser.py(which I suppose is shared between the live mode and the manual poser app, so we can't make any changes there that would break live mode) can't findtha3.poser.modes.separable_float.The
create_poserfunction takes amodule_file_namesdict, which can take a path for each model part, but the callerload_poserdoesn't take such an argument from its caller, and in any case, using it would break the division of responsibilities (since it's each model's job to know its filenames).Probably the best solution would be to allow providing an override for the default directory (while keeping the original filenames), and use that in the manual poser?
Maybe I'll just wait if anyone has better ideas. :)
@Cohee1207 commented on GitHub (Dec 14, 2023):
I have no idea, sorry, I didn't develop it. Honestly this module feels an unnecessary burden to support. The results are uncanny and it's very unoptimized. Any reason you're specifically looking into it and not a real live2d plugin?
@Technologicat commented on GitHub (Dec 14, 2023):
Ok.
Maybe I should explain my use case. It's not AItubing. :)
At the moment, I'm looking into LLMs mainly for two target applications: retrieval-powered question answering for serious scientific use (to be able to skim papers faster), and AI-powered storywriting for personal use. I'm also interested in an AIDungeon-like interactive text adventure/roleplay use case, but haven't had the time to properly set up and play an adventure yet.
The thing is, I find that interfacing with a faceless LLM feels cold. So I want the system to present itself as a virtual anime character.
Of course, I'm aware that an LLM is a simulator, not a character (a good writeup of the discussion surrounding this is Shanahan et al., 2023); but presenting itself as a specific character yields a nice user interface. Original character, mind you - I'm not interested in making existing anime or video game characters answer my questions about numerical methods and such.
So, I was intrigued by the prospect of an automatic tool to generate character expressions. If I only need to provide one static image per character, that's much more manageable than 28 (when using
classifypowered by distillbert). This would allow agile editing of the character's visual appearance.Instead of a whole evening of inpainting in Stable Diffusion, creating a new character (or modifying the look of an existing one) would only take 30 minutes at most, including everything: playing around with the Stable Diffusion prompt, rerolling txt2img to get the perfect shot, and finally automatically removing the background with rembg.
As for why, agile is not just a software development methodology, it's a lifestyle.
Generating a set of static images by an offline (batch) process would be fine, which is why I was looking into the manual poser.
The live mode is just a nice bonus. It would make the character feel more alive, and as I said, it works fine, but as you said, it needs optimization.
As for live2d, it's proprietary so I'd rather avoid it, and I'm not even sure if it runs on Linux. Their download page didn't say.
Anyway, while I don't have a lot of time for extra software development projects, I might take a look if I can get the manual poser working.
In any case I think
talkingheadis a really cool technology demo, so if possible, I'd prefer keeping it around. This andwebsearchare why I installedextrasin the first place.@Technologicat commented on GitHub (Dec 14, 2023):
I got the manual poser working!
Only needed to pass the correct model paths without breaking the
app.pyuse case.Small PR to follow.
Obviously, a single static image has its limitations, but in a reasonable parameter range, at least for the example character... wow. Just, wow.
This is exactly what I was looking for.
@Technologicat commented on GitHub (Dec 14, 2023):
Posted the PR. See #203.
@Technologicat commented on GitHub (Dec 15, 2023):
Closing this since the app works now. Let's track the ongoing changes in the PR ticket.