-
-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: What just happen? Manga Translator became Unusable at latest commit @,@ #756
Comments
I moved everything to a config file, which makes it easier to use & understand. could support templates for different use cases easier. the --mode argument didn't really make sense in the first place so you just us either like this |
#757 for more info |
I got unrecognized args using your config structure and config examples can you clarify this ? manga_translator: error: unrecognized arguments: -v --attempts 100 --font-path fonts/SSRosehipBold.otf --config-file=config-example.json |
@BlaskKilt my bad I wrote parser instead of parser_batch in file args.py:108 |
also don't forget font path and ignore errors in local ignore errors for me is helpful when mocr getting error by division by zero which I prefer skip usage: manga_translator [-h] [-v] [--attempts ATTEMPTS] [--ignore-errors] |
@BlaskKilt just noticed that argparse is a piece of shit & the order in which you define the structure of the args actually matters. I fixed this stupid order thing with this workaround. pushed to a open pull request:
|
@BlaskKilt these belong to the global parser, which seems to require these args to be placed before the mode which is unintuitive to me. what I did to work around that was to parse the args once & every unknown arg gets rephrased by the global parser. I think it should do that by default, but it does not. is fixed in #759 |
Thanks, by the way, for taking on the cumbersome work. You have my appreciation. I am also glad I could be of help to you until the issue gets fix I'll be waiting until these merges to main |
Can you add --detector and --detection-size to usage command its more good for me If I use it as command cause I'm changing detector every batch translate because of errors and --detection-size for it's right size some images trip up the detector until I fix detection-size same problem as detector that causes error |
@BlaskKilt it kinda belongs in a config file & for the API takes the config as input. Maybe something that can override the config would be useful to you. I usually use the api anyway, bc you don’t have the startup time. The ages are only stuff that needs to be set at startup& things that can be changed at runtime(server) is in the config. Why don’t you ask ChatGPT to write you a simple bash script that replaces the detector &detection-size(regex) in the config and executes the translator afterwards |
I'm open to any alternative is good thank you |
The thing is I'm using VPS server kinda shorten it for me if I directly command it. |
let me introduce you to bash scripting. you let chatgpt write your own little script that does the job for you. don't see the issue. btw if you are using a server why aren't you using the server/main.py. you don't need to wait for the startup & can just send the requests with the config you need to your server. don't really see the point there to host it on a server to run it manually #!/bin/bash
# Function to print usage
usage() {
echo "Usage: $0 [options]"
echo "Options:"
echo " -h, --help Show this help message"
echo " -a, --arg ARG Argument with a value"
echo " -f, --flag Flag without a value"
echo " -n, --number NUMBER Argument with a number"
exit 1
}
# Check if no arguments are provided
if [ $# -eq 0 ]; then
usage
fi
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h|--help)
usage
;;
-a|--arg)
ARG_VALUE="$2"
echo "Argument: $ARG_VALUE"
shift # past argument
shift # past value
;;
-f|--flag)
echo "Flag is set"
shift # past argument
;;
-n|--number)
NUMBER_VALUE="$2"
echo "Number: $NUMBER_VALUE"
shift # past argument
shift # past value
;;
*)
echo "Unknown option: $key"
usage
;;
esac
done |
Thanks, I will use it when I finish fixing my local as intended or is there batch translations for server? not like the previous one? tested the server now Can we have option for groq as translator? |
Issue
root@For-src:~/test-manga-image-translator# python3 -m manga_translator -h
usage: manga_translator [-h] [-v] [--attempts ATTEMPTS] [--ignore-errors] [--model-dir MODEL_DIR]
[--use-gpu | --use-gpu-limited] [--font-path FONT_PATH] [--pre-dict PRE_DICT] [--post-dict POST_DICT]
[--kernel-size KERNEL_SIZE] [--config-file CONFIG_FILE]
{local,ws,shared} ...
Seamlessly translate mangas into a chosen language
positional arguments:
{local,ws,shared} Mode of operation
local Run in batch translation mode
ws Run in WebSocket mode
shared Run in API mode
options:
-h, --help show this help message and exit
-v, --verbose Print debug info and save intermediate images in result folder
--attempts ATTEMPTS Retry attempts on encountered error. -1 means infinite times.
--ignore-errors Skip image on encountered error.
--model-dir MODEL_DIR
Model directory (by default ./models in project root)
--use-gpu Turn on/off gpu (auto switch between mps and cuda)
--use-gpu-limited Turn on/off gpu (excluding offline translator)
--font-path FONT_PATH
Path to font file
--pre-dict PRE_DICT Path to the pre-translation dictionary file
--post-dict POST_DICT
Path to the post-translation dictionary file
--kernel-size KERNEL_SIZE
Set the convolution kernel size of the text erasure area to completely clean up text residues
--config-file CONFIG_FILE
path to the config file
Cooking new arguments?
Command Line Arguments
Console logs
Thanks very much for the #703 update though works very well for me as an isolated commit
The text was updated successfully, but these errors were encountered: