Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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]尝试用ChatGPT把.bat转化成.sh,但出现报错 #13

Closed
ghitnm opened this issue Apr 13, 2023 · 1 comment
Closed

[BUG]尝试用ChatGPT把.bat转化成.sh,但出现报错 #13

ghitnm opened this issue Apr 13, 2023 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@ghitnm
Copy link

ghitnm commented Apr 13, 2023

不会代码,使用ChatGPT转化的

转化的sh文件

#!/bin/bash

设置虚拟环境变量

VENV_NAME=venv

如果虚拟环境不存在,则创建一个虚拟环境

if [ ! -d "$VENV_NAME" ]; then
echo "Creating virtual environment $VENV_NAME..."
python3 -m venv $VENV_NAME
fi

显示虚拟环境已准备就绪

echo "Virtual environment $VENV_NAME is ready."

激活虚拟环境

echo "Activating Virtual environment!"
source ./venv/bin/activate

检查库更新

REQUIREMENTS="requirements.txt"
LAST_MODIFIED="requirements.temp"

检查 requirements.txt 文件是否存在

if [ ! -f "$REQUIREMENTS" ]; then
echo "Error: requirements.txt not found"
exit 1
fi

检查 last_modified.txt 文件是否存在

if [ ! -f "$LAST_MODIFIED" ]; then
echo "0" > "$LAST_MODIFIED"
fi

检查 requirements.txt 文件是否被修改

mod_date=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$REQUIREMENTS")
last_mod_date=$(cat "$LAST_MODIFIED")

if [ "$mod_date" != "$last_mod_date" ]; then
pip3 install -r $REQUIREMENTS
echo "$mod_date" > "$LAST_MODIFIED"
clear
echo "Requirements file has been modified. Updated complete!"
else
echo "Requirements file has not been modified. Skipping update."
fi

运行 SumGPT.py 程序

streamlit run src/SumGPT.py


报错内容

2023-04-13 22:47:24.330 Uncaught app exception
Traceback (most recent call last):
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/SumGPT.py", line 2, in
import Components
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/Components/init.py", line 1, in
from Components import sidebar
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/Components/sidebar.py", line 2, in
import GPT
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/GPT/init.py", line 1, in
from GPT import misc
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/GPT/misc.py", line 48, in
def predict_token_single(chunk: Dict[str, Union[str, float]] | str, max_tokens: int = None) -> int:
TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'type'
2023-04-13 22:47:28.079 Uncaught app exception
Traceback (most recent call last):
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/SumGPT.py", line 2, in
import Components
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/Components/init.py", line 1, in
from Components import sidebar
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/Components/sidebar.py", line 2, in
import GPT
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/GPT/init.py", line 1, in
from GPT import misc
File "/Users/sing/Downloads/333333/SumGPT-1.0.5/src/GPT/misc.py", line 48, in
def predict_token_single(chunk: Dict[str, Union[str, float]] | str, max_tokens: int = None) -> int:
TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'type'

@ghitnm ghitnm added the bug Something isn't working label Apr 13, 2023
@sean1832 sean1832 added help wanted Extra attention is needed and removed bug Something isn't working labels Apr 14, 2023
@sean1832
Copy link
Owner

哈喽,我本人使用的是windows系统,不怎么会用.sh 所以我也不怎么知道😂。

Repository owner locked and limited conversation to collaborators Apr 14, 2023
@sean1832 sean1832 converted this issue into discussion #14 Apr 14, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants