Skip to content
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

config不生效 #689

Open
4 tasks done
xy3xy3 opened this issue Feb 25, 2025 · 2 comments
Open
4 tasks done

config不生效 #689

xy3xy3 opened this issue Feb 25, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@xy3xy3
Copy link

xy3xy3 commented Feb 25, 2025

在提问之前...

  • 我已经搜索了现有的 issues
  • 我在提问题之前至少花费了 5 分钟来思考和准备
  • 我已经认真且完整的阅读了 wiki
  • 我已经认真检查了问题和网络环境无关(包括但不限于Google不可用,模型下载失败)

使用的环境

- OS:windows
- Python:3.12
- pdf2zh:1.9.2

描述你的问题

使用下面config在批量执行下无法正常调用openai,选了默认 的谷歌翻译

File: config.json

{
  "USE_MODELSCOPE": "0",
  "PDF2ZH_LANG_FROM": "English",
  "PDF2ZH_LANG_TO": "Simplified Chinese",
  "NOTO_FONT_PATH": "/app/SourceHanSerifCN-Regular.ttf",
  "translators": [
    {
      "name": "openai",
      "envs": {
        "OPENAI_BASE_URL": "https://ark.cn-beijing.volces.com/api/v3",
        "OPENAI_API_KEY": "***",
        "OPENAI_MODEL": "doubao-1-5-lite-32k-250115"
      }
    }
  ]
}

如何复现

在目录保存./config.json后
执行

./pdf2zh.exe --dir 文件夹 --config ./config.json

预期行为

正常调用openai接口而不是谷歌翻译

相关 Logs

(main) PS D:\Program_Green\pdf翻译> ls

    Directory: D:\Program_Green\pdf翻译

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           2025/2/25    22:42                .gradio
d----           2025/2/25    23:02                pdf2zh_files
d----           2025/2/25    22:40                runtime
d----           2025/2/25    22:42                site-packages
-a---           2025/2/23     4:05            157 _pystand_static.int
-a---           2025/2/25    23:09             87 cmd.txt
-a---           2025/2/25    23:08            450 config.json
-a---           2025/2/23     4:05         149504 pdf2zh.exe

(main) PS D:\Program_Green\pdf翻译> ./pdf2zh.exe --dir D:/BaiduSyncdisk/大三下/编译原理/ppt --config ./config.json
argos-translate is not installed, argostranslate will not work. if you want to use argostranslate, please install it.
Namespace(files=['D:/BaiduSyncdisk/大三下/编译原理/ppt'], debug=False, pages=None, vfont='', vchar='', lang_in='en', lang_out='zh', service='google', output='', thread=4, interactive=False, share=False, flask=False, celery=False, authorized=None, prompt=None, compatible=False, onnx=None, serverport=None, dir=True, config='./config.json', babeldoc=False)
  0%|                                                                                         | 0/44 [00:00<?, ?it/s]ERROR:pdf2zh.converter:HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: /m?tl=zh-CN&sl=en&q=School+of+Computer+Science+and+Engineering+lnslwj%40mail.sysu.edu.cn (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000244A212D880>, 'Connection to translate.google.com timed out. (connect timeout=None)'))
ERROR:pdf2zh.converter:HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: /m?tl=zh-CN&sl=en&q=Prof.+Wen-jun+LI (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000244A212C5F0>, 'Connection to translate.google.com timed out. (connect timeout=None)'))
ERROR:pdf2zh.converter:HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: /m?tl=zh-CN&sl=en&q=Principles+of++Compiler+Construction (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000244A212D070>, 'Connection to translate.google.com timed out. (connect timeout=None)'))

原始PDF文件

No response

还有别的吗?

No response

@xy3xy3 xy3xy3 added the bug Something isn't working label Feb 25, 2025
@xy3xy3
Copy link
Author

xy3xy3 commented Feb 25, 2025

在网页版配置接口后
./pdf2zh.exe --dir D:/BaiduSyncdisk/大三下/编译原理/ppt -s openai:doubao-1-5-lite-32k-250115
就可以
也许是我要用-s在后面

@hellofinch
Copy link
Contributor

根据问题描述来看,./config.json第一次没有读入。
我需要测试一下尝试复习问题,如有进展会在这个issue中更新。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants