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

AttributeError: 'Tab' object has no attribute 'constructor_args' #2985

Open
xiezhipeng-git opened this issue Jan 24, 2025 · 4 comments
Open

Comments

@xiezhipeng-git
Copy link

xiezhipeng-git commented Jan 24, 2025

Describe the bug
What the bug is, and how to reproduce, better with screenshots(描述bug以及复现过程,最好有截图)
通过webUi 启动
vscode lauch.json

{
            "name": "swift web-ui",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceRoot}/swift/cli/web_ui.py",
            // "program": "${workspaceRoot}swift/cli/main.py",
            "args": [
                        // "webui"
                    ],
            "justMyCode": false,
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}",
            "env": {
                "PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}",
            }
        }

Your hardware and system info
Write your system info like CUDA version/system/GPU/torch version here(在这里给出硬件信息和系统信息,如CUDA版本,系统,GPU型号和torch版本等)
Name: torch
Version: 2.5.1
GPU 4090
CUDA Build cuda_12.6.r12.6/compiler.34841621_0
system windows 10 wsl Ubuntun24.04
Additional context
Add any other context about the problem here(在这里补充其他信息)
最新的github main 版本。另外如果gradio 版本高一些有其他错误

发生异常: AttributeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
'Tab' object has no attribute 'constructor_args'
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/ui/base.py", line 63, in wrapper
    self.constructor_args.update(kwargs)
    ^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/ui/llm_train/llm_train.py", line 208, in do_build_ui
    with gr.TabItem(elem_id='llm_train', label=''):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/ui/base.py", line 120, in build_ui
    cls.do_build_ui(base_tab)
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/ui/app.py", line 64, in run
    LLMTrain.build_ui(LLMTrain)
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/llm/base.py", line 46, in main
    result = self.run()
             ^^^^^^^^^^
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/ui/app.py", line 92, in webui_main
    return SwiftWebUI(args).main()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/my/work/LLM/ai_train/ms-swift/swift/cli/web_ui.py", line 5, in <module>
    webui_main()
  File "/root/anaconda3/lib/python3.12/runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "/root/anaconda3/lib/python3.12/runpy.py", line 198, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,
AttributeError: 'Tab' object has no attribute 'constructor_args'

看起来 和 Gradio 版本有关。当前使用的版本是3.40.0
并且升级后没有这个问题。但是有其他问题
#2782

Traceback (most recent call last):
  File "/root/anaconda3/lib/python3.12/site-packages/gradio/queueing.py", line 625, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/gradio/route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/gradio/blocks.py", line 2040, in process_api
    inputs = await self.preprocess_data(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/gradio/blocks.py", line 1735, in preprocess_data
    processed_input.append(block.preprocess(inputs_cached))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/gradio/components/dropdown.py", line 198, in preprocess
    raise Error(
gradio.exceptions.Error: "Value: {'__type__': 'update'} (type: <class 'dict'>) is not in the list of choices: ['qwen', 'qwen2', 'qwen2_5', 'qwen2_5_math', 'qwen2_moe', 'qwq', 'codefuse_qwen', 'modelscope_agent', 'marco_o1', 'llama', 'llama3', 'llama3_1', 'llama3_2', 'reflection', 'megrez', 'yi', 'yi_coder', 'sus', 'codefuse_codellama', 'mengzi3', 'ziya', 'numina', 'atom', 'chatglm2', 'chatglm3', 'glm4', 'glm_edge', 'codefuse_codegeex2', 'codegeex4', 'longwriter_llama3_1', 'internlm', 'internlm2', 'internlm3', 'deepseek', 'deepseek_moe', 'deepseek_v2', 'deepseek_v2_5', 'deepseek_r1', 'deepseek_r1_distill', 'openbuddy_llama', 'openbuddy_llama3', 'openbuddy_mistral', 'openbuddy_mixtral', 'baichuan', 'baichuan2', 'minicpm', 'minicpm_chatml', 'minicpm3', 'minicpm_moe', 'telechat', 'telechat2', 'mistral', 'zephyr', 'mixtral', 'mistral_nemo', 'wizardlm2', 'wizardlm2_moe', 'phi2', 'phi3_small', 'phi3', 'phi3_moe', 'phi4', 'minimax', 'gemma', 'gemma2', 'skywork', 'skywork_o1', 'yuan2', 'orion', 'xverse', 'xverse_moe', 'seggpt', 'bluelm', 'c4ai', 'dbrx', 'grok', 'mamba', 'polylm', 'aya', 'qwen_vl', 'qwen_audio', 'qwen2_vl', 'qwen2_audio', 'qvq', 'ovis1_6', 'ovis1_6_llama3', 'glm4v', 'glm_edge_v', 'cogvlm', 'cogagent_vqa', 'cogagent_chat', 'cogvlm2', 'cogvlm2_video', 'internvl', 'internvl_phi3', 'internvl2', 'internvl2_phi3', 'internvl2_5', 'xcomposer2', 'xcomposer2_4khd', 'xcomposer2_5', 'xcomposer2_5_ol_audio', 'llama3_2_vision', 'llama3_1_omni', 'llava1_5_hf', 'llava1_6_mistral_hf', 'llava1_6_vicuna_hf', 'llava1_6_yi_hf', 'llama3_llava_next_hf', 'llava_next_qwen_hf', 'llava_next_video_hf', 'llava_next_video_yi_hf', 'llava_onevision_hf', 'yi_vl', 'llava_llama3_1_hf', 'llava_llama3_hf', 'llava1_6_mistral', 'llava1_6_yi', 'llava_next_qwen', 'llama3_llava_next', 'deepseek_vl', 'deepseek_vl2', 'deepseek_janus', 'minicpmv', 'minicpmv2_5', 'minicpmv2_6', 'minicpmo2_6', 'minimax_vl', 'mplug_owl2', 'mplug_owl2_1', 'mplug_owl3', 'mplug_owl3_241101', 'doc_owl2', 'emu3_gen', 'emu3_chat', 'got_ocr2', 'phi3_vision', 'florence', 'idefics3', 'paligemma', 'molmo', 'molmoe', 'pixtral', 'megrez_omni', 'valley', 'modern_bert', 'bert', 'internlm2_reward', 'qwen2_reward', 'qwen2_5_prm', 'qwen2_5_math_reward', 'llama3_2_reward', 'gemma_reward']"

@Jintao-Huang

@Jintao-Huang
Copy link
Collaborator

@tastelikefeet

@tastelikefeet
Copy link
Collaborator

请使用gradio>=3.50.2
第二个错误的复现步骤能给一下吗

@xiezhipeng-git
Copy link
Author

xiezhipeng-git commented Jan 28, 2025

@tastelikefeet
和第一个错误的复现步骤基本一样。只需要升级gradio
然后参数随便选,接着点击生成预览命令 就有这个错误了。还没开始训练

@xiezhipeng-git
Copy link
Author

xiezhipeng-git commented Feb 4, 2025

@tastelikefeet
更新github代码

[INFO:swift] output_dir: output/Qwen2.5-7B-Instruct/v0-20250204-215033
[INFO:swift] Run training: CUDA_VISIBLE_DEVICES=0  nohup swift sft --torch_dtype 'bfloat16' --model 'Qwen/Qwen2.5-7B-Instruct' --model_type 'qwen2_5' --template 'qwen2_5' --system 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' --dataset 'AI-ModelScope/alpaca-gpt4-data-zh' --max_length '1024' --init_weights 'True' --learning_rate '1e-4' --attn_impl 'flash_attn' --gradient_accumulation_steps '16' --eval_steps '500'  --add_version False --output_dir /mnt/d/my/work/LLM/ai_train/ms-swift/output/Qwen2.5-7B-Instruct/v0-20250204-215033 --logging_dir /mnt/d/my/work/LLM/ai_train/ms-swift/output/Qwen2.5-7B-Instruct/v0-20250204-215033/runs --ignore_args_error True > /mnt/d/my/work/LLM/ai_train/ms-swift/output/Qwen2.5-7B-Instruct/v0-20250204-215033/runs/run.log 2>&1 &

这样的信息代表着生成的运行命令不会报错了是吧。
但是生成运行命令为什么不能像llamafactory 那样。直接展示在web界面。而是在控制台呢?并且应该把训练按钮和生成运行命令分开吧。
然后展示在web界面选择保存为文件,类似llamafactory 。
接着,如果在增加
#2994
然后统一下生成的sh命令的格式。去掉特殊格式,比如目前的dpo.sh的特殊命令。形成生成预览,保存文件,接着直接使用保存的文件运行训练。整体预览命令功能就闭环了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants