gpt_academic README

The project's README from github.com/binary-husky/gpt_academic. As one markdown file: README.md.

[!IMPORTANT]

master主分支最新动态(2026.1.25): 新GUI前端测试中,Coming Soon
master主分支最新动态(2025.8.23): Dockerfile构建效率大幅优化
2025.2.2: 三分钟快速接入最强qwen2.5-max视频
2025.2.1: 支持自定义字体
2024.10.10: 突发停电,紧急恢复了提供whl包的文件服务器
2024.5.1: 加入Doc2x翻译PDF论文的功能,查看详情
2024.3.11: 全力支持Qwen、GLM、DeepseekCoder等中文大语言模型! SoVits语音克隆模块,查看详情
2024.1.17: 安装依赖时,请选择requirements.txt中指定的版本。 安装命令:pip install -r requirements.txt。


GPT 学术优化 (GPT Academic)

Github License Releases Installation Wiki PR


如果喜欢这个项目,请给它一个Star;如果您发明了好用的快捷键或插件,欢迎发pull requests!

If you like this project, please give it a Star. Read this in English | 日本語 | 한국어 | Русский | Français. All translations have been provided by the project itself. To translate this project to arbitrary language with GPT, read and run multi_language.py (experimental).

[!NOTE] 1.本项目中每个文件的功能都在自译解报告self_analysis.md详细说明。随着版本的迭代,您也可以随时自行点击相关函数插件,调用GPT重新生成项目的自我解析报告。常见问题请查阅wiki。 常规安装方法 一键安装脚本 配置说明 wiki

2.本项目兼容并鼓励尝试国内中文大语言基座模型如通义千问,智谱GLM等。支持多个api-key共存,可在配置文件中填写如API_KEY="openai-key1,openai-key2,azure-key3,api2d-key4"。需要临时更换API_KEY时,在输入区输入临时的API_KEY然后回车键提交即可生效。



功能(⭐= 近期新增功能) 描述
⭐接入新模型 百度千帆与文心一言, 通义千问Qwen,上海AI-Lab书生,讯飞星火,LLaMa2,智谱GLM4,DALLE3, DeepseekCoder
⭐支持mermaid图像渲染 支持让GPT生成流程图、状态转移图、甘特图、饼状图、GitGraph等等(3.7版本)
⭐Arxiv论文精细翻译 (Docker) [插件] 一键以超高质量翻译arxiv论文,目前最好的论文翻译工具
⭐实时语音对话输入 [插件] 异步监听音频,自动断句,自动寻找回答时机
⭐虚空终端插件 [插件] 能够使用自然语言直接调度本项目其他插件
润色、翻译、代码解释 一键润色、翻译、查找论文语法错误、解释代码
自定义快捷键 支持自定义快捷键
模块化设计 支持自定义强大的插件,插件支持热更新
程序剖析 [插件] 一键剖析Python/C/C++/Java/Lua/...项目树 或 自我剖析
读论文、翻译论文 [插件] 一键解读latex/pdf论文全文并生成摘要
Latex全文翻译、润色 [插件] 一键翻译或润色latex论文
批量注释生成 [插件] 一键批量生成函数注释
Markdown中英互译 [插件] 看到上面5种语言的README了吗?就是出自他的手笔
PDF论文全文翻译功能 [插件] PDF论文提取题目&摘要+翻译全文(多线程)
Arxiv小助手 [插件] 输入arxiv文章url即可一键翻译摘要+下载PDF
Latex论文一键校对 [插件] 仿Grammarly对Latex文章进行语法、拼写纠错+输出对照PDF
谷歌学术统合小助手 [插件] 给定任意谷歌学术搜索页面URL,让gpt帮你写relatedworks
互联网信息聚合+GPT [插件] 一键让GPT从互联网获取信息回答问题,让信息永不过时
公式/图片/表格显示 可以同时显示公式的tex形式和渲染形式,支持公式、代码高亮
启动暗色主题 在浏览器url后面添加/?__theme=dark可以切换dark主题
多LLM模型支持 同时被GPT3.5、GPT4、清华ChatGLM2、复旦MOSS伺候的感觉一定会很不错吧?
更多LLM模型接入,支持huggingface部署 加入Newbing接口(新必应),引入清华Jittorllms支持LLaMA和盘古α
⭐void-terminal pip包 脱离GUI,在Python中直接调用本项目的所有函数插件(开发中)
更多新功能展示 (图像生成等) …… 见本文档结尾处 ……



Installation

flowchart TD
    A{"安装方法"} --> W1("I 🔑直接运行 (Windows, Linux or MacOS)")
    W1 --> W11["1 Python pip包管理依赖"]
    W1 --> W12["2 Anaconda包管理依赖(推荐⭐)"]

    A --> W2["II 🐳使用Docker (Windows, Linux or MacOS)"]

    W2 --> k1["1 部署项目全部能力的大镜像(推荐⭐)"]
    W2 --> k2["2 仅在线模型(GPT, GLM4等)镜像"]
    W2 --> k3["3 在线模型 + Latex的大镜像"]

    A --> W4["IV 🚀其他部署方法"]
    W4 --> C1["1 Windows/MacOS 一键安装运行脚本(推荐⭐)"]
    W4 --> C2["2 Huggingface, Sealos远程部署"]
    W4 --> C4["3 其他 ..."]

安装方法I:直接运行 (Windows, Linux or MacOS)

  1. 下载项目

    git clone --depth=1 https://github.com/binary-husky/gpt_academic.git
    cd gpt_academic
    
  2. 配置API_KEY等变量

    在config.py中,配置API KEY等变量。特殊网络环境设置方法、Wiki-项目配置说明。

    「 程序会优先检查是否存在名为config_private.py的私密配置文件,并用其中的配置覆盖config.py的同名配置。如您能理解以上读取逻辑,我们强烈建议您在config.py同路径下创建一个名为config_private.py的新配置文件,并使用config_private.py配置项目,从而确保自动更新时不会丢失配置 」。

    「 支持通过环境变量配置项目,环境变量的书写格式参考docker-compose.yml文件或者我们的Wiki页面。配置读取优先级: 环境变量 > config_private.py > config.py 」。

  3. 安装依赖

    # (选择I: 如熟悉python, python推荐版本 3.9 ~ 3.11)备注:使用官方pip源或者阿里pip源, 临时换源方法:python -m pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
    python -m pip install -r requirements.txt
    
    # (选择II: 使用Anaconda)步骤也是类似的 (https://www.bilibili.com/video/BV1rc411W7Dr):
    conda create -n gptac_venv python=3.11    # 创建anaconda环境
    conda activate gptac_venv                 # 激活anaconda环境
    python -m pip install -r requirements.txt # 这个步骤和pip安装一样的步骤
    
    # (选择III: 使用uv):
    uv venv --python=3.11   # 创建虚拟环境
    source ./.venv/bin/activate # 激活虚拟环境
    uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ # 安装依赖
    
如果需要支持清华ChatGLM系列/复旦MOSS/RWKV作为后端,请点击展开此处

【可选步骤】如果需要支持清华ChatGLM系列/复旦MOSS作为后端,需要额外安装更多依赖(前提条件:熟悉Python + 用过Pytorch + 电脑配置够强):

# 【可选步骤I】支持清华ChatGLM3。清华ChatGLM备注:如果遇到"Call ChatGLM fail 不能正常加载ChatGLM的参数" 错误,参考如下: 1:以上默认安装的为torch+cpu版,使用cuda需要卸载torch重新安装torch+cuda; 2:如因本机配置不够无法加载模型,可以修改request_llm/bridge_chatglm.py中的模型精度, 将 AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) 都修改为 AutoTokenizer.from_pretrained("THUDM/chatglm-6b-int4", trust_remote_code=True)
python -m pip install -r request_llms/requirements_chatglm.txt

# 【可选步骤II】支持清华ChatGLM4 注意:此模型至少需要24G显存
python -m pip install -r request_llms/requirements_chatglm4.txt
# 可使用modelscope下载ChatGLM4模型
# pip install modelscope
# modelscope download --model ZhipuAI/glm-4-9b-chat --local_dir ./THUDM/glm-4-9b-chat

# 【可选步骤III】支持复旦MOSS
python -m pip install -r request_llms/requirements_moss.txt
git clone --depth=1 https://github.com/OpenLMLab/MOSS.git request_llms/moss  # 注意执行此行代码时,必须处于项目根路径

# 【可选步骤IV】支持RWKV Runner
参考wiki:https://github.com/binary-husky/gpt_academic/wiki/%E9%80%82%E9%85%8DRWKV-Runner

# 【可选步骤V】确保config.py配置文件的AVAIL_LLM_MODELS包含了期望的模型,目前支持的全部模型如下(jittorllms系列目前仅支持docker方案):
AVAIL_LLM_MODELS = ["gpt-3.5-turbo", "api2d-gpt-3.5-turbo", "gpt-4", "api2d-gpt-4", "chatglm", "moss"] # + ["jittorllms_rwkv", "jittorllms_pangualpha", "jittorllms_llama"]

# 【可选步骤VI】支持本地模型INT8,INT4量化(这里所指的模型本身不是量化版本,目前deepseek-coder支持,后面测试后会加入更多模型量化选择)
pip install bitsandbyte
# windows用户安装bitsandbytes需要使用下面bitsandbytes-windows-webui
python -m pip install bitsandbytes --prefer-binary --extra-index-url=https://jllllll.github.io/bitsandbytes-windows-webui
pip install -U git+https://github.com/huggingface/transformers.git
pip install -U git+https://github.com/huggingface/accelerate.git
pip install peft

  1. 运行
    python main.py
    

安装方法II:使用Docker

  1. 部署项目的全部能力(这个是包含cuda和latex的大型镜像。但如果您网速慢、硬盘小,则不推荐该方法部署完整项目) fullcapacity

    # 修改docker-compose.yml,保留方案0并删除其他方案。然后运行:
    docker-compose up
    
  2. 仅ChatGPT + GLM4 + 文心一言+spark等在线模型(推荐大多数人选择) basic basiclatex basicaudio

    # 修改docker-compose.yml,保留方案1并删除其他方案。然后运行:
    docker-compose up
    

P.S. 如果需要依赖Latex的插件功能,请见Wiki。另外,您也可以直接使用方案4或者方案0获取Latex功能。

  1. ChatGPT + GLM3 + MOSS + LLAMA2 + 通义千问(需要熟悉Nvidia Docker运行时) chatglm

    # 修改docker-compose.yml,保留方案2并删除其他方案。然后运行:
    docker-compose up
    

安装方法III:其他部署方法

  1. Windows一键运行脚本。 完全不熟悉python环境的Windows用户可以下载Release中发布的一键运行脚本安装无本地模型的版本。脚本贡献来源:oobabooga。

  2. 使用第三方API、Azure等、文心一言、星火等,见Wiki页面

  3. 云服务器远程部署避坑指南。 请访问云服务器远程部署wiki

  4. 在其他平台部署&二级网址部署



Advanced Usage

I:自定义新的便捷按钮(学术快捷键)

现在已可以通过UI中的界面外观菜单中的自定义菜单添加新的便捷按钮。如果需要在代码中定义,请使用任意文本编辑器打开core_functional.py,添加如下条目即可:

"超级英译中": {
    # 前缀,会被加在你的输入之前。例如,用来描述你的要求,例如翻译、解释代码、润色等等
    "Prefix": "请翻译把下面一段内容成中文,然后用一个markdown表格逐一解释文中出现的专有名词:\n\n",

    # 后缀,会被加在你的输入之后。例如,配合前缀可以把你的输入内容用引号圈起来。
    "Suffix": "",
},

II:自定义函数插件

编写强大的函数插件来执行任何你想得到的和想不到的任务。 本项�

gpt_academic (binary-husky/gpt_academic)

Searching Database…

What is this?GPT Academic is a Python web UI that gives practical interaction tools for GPT/GLM and other LLMs, specialized for reading, polishing and writing academic papers, with modular plugin functions for code analysis and PDF/LaTeX translation.
Is this a standalone app or a library I import into my code?It's a self-hosted web application you run locally (via Python or Docker) and interact with through a browser UI, not a library you import.
How do I get it running?Download the project, set your API keys in config.py (or a private config.py), install dependencies with pip, then run the app; alternatively deploy with Docker using one of the provided compose options.
Do I need an OpenAI API key, or can I use other models?You can configure one or multiple API keys for OpenAI, Azure, api2d etc. in config.py, and it also supports local/Chinese models like ChatGLM3, Qwen, Spark, LLaMA2, MOSS, RWKV without necessarily needing an OpenAI key.
Any pitfalls when installing local models like ChatGLM or MOSS?Supporting local backends like ChatGLM/MOSS/RWKV requires extra dependencies and reasonable hardware (familiarity with Python and PyTorch, and decent PC specs), and the full-capability Docker image including CUDA and LaTeX is large.
Does it run on Windows as well as Linux/Mac?Yes, it runs directly on Windows, Linux or macOS, and there's also a one-click Windows script for users unfamiliar with Python.
Can I translate entire LaTeX or PDF papers, not just abstracts?Yes, there are dedicated plugins for full-text LaTeX translation/polishing and full-text PDF paper translation with summaries, using multi-threading.
Can multiple LLMs be queried at the same time?Yes, it supports parallel querying of multiple LLM models, including mixing ChatGLM with OpenAI GPT-3.5/GPT-4.
Can I add my own custom functions or shortcut buttons?Yes, the UI lets you add custom shortcut buttons through its appearance menu, and you can write new function plugins in functional.py or corefunctional.py that hot-reload.
What is the void-terminal feature?It's a pip package in development that lets you call all of the project's function plugins directly from Python code without using the GUI.
Size
71.1 MB
Stars
71.5K
Age
3y
Commits · 90 Days