-
Notifications
You must be signed in to change notification settings - Fork 6
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
modify run_benchmark.sh #75
base: main
Are you sure you want to change the base?
Conversation
onebench/diffusers/run_benchmark.sh
Outdated
|
||
export HUGGING_FACE_HUB_TOKEN=hf_ | ||
export HF_HOME=/hf/home | ||
export HF_HOME=/data/home/zhouhongjun/sd_test/hf/home |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里还是用原来的,不要出现个人信息在里面
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我修改了下,改成下面这种可以自动创建文件夹的方式,因为原来的地址的话会有pemisson denied的提醒。
SRC_DIR=$(realpath $(dirname $0))
mkdir -p ${SRC_DIR}/hf/home
export HUGGING_FACE_HUB_TOKEN=hf_
export HF_HOME=${SRC_DIR}/hf/home
if [ "$STABLE_VERSION" == "taiyi" ]; then | ||
sed -i 's/from diffusers/from onediff/g' ./scripts/$BENCHMARK_SCRIPT | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这三个判断有没有可能优化一下,比如from diffusers/from onediff是不是公用的了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
关于这三个判断主要是因为diffusion-benchmark仓库的原始文件的import写的格式不一样。stable_diffusion_2.py要从
from diffusers import (
OneFlowStableDiffusionPipeline as StableDiffusionPipeline,
OneFlowEulerDiscreteScheduler as EulerDiscreteScheduler,
)
改成
from diffusers import EulerDiscreteScheduler
from onediff import OneFlowStableDiffusionPipelinev as StableDiffusionPipeline
stable_diffusion_v1_5.py和taiyi_stable_diffusion_chinese.py要从
from diffusers import OneFlowStableDiffusionPipeline as StableDiffusionPipeline
改成
from onediff import OneFlowStableDiffusionPipelinev as StableDiffusionPipeline
最后stable_diffusion_v1_5.py和stable_diffusion_2_0.py 要单独添加
torch.mock_torch.enable()
所以感觉上找不到三个通用的修改方法。
onebench/diffusers/run_benchmark.sh
Outdated
fi | ||
|
||
cat ./scripts/$BENCHMARK_SCRIPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是没用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是为了查看修改是否成功的,可以删掉
echo "oneflow-diffusers(git_commit)=$ONEFLOW_DIFFUSERS_COMMIT" >> ${LOG_FILENAME}.log | ||
|
||
### pytorch | ||
DL_FRAME="pytorch" | ||
LOG_FOLDER=stable_logs/$GPU_NAME/$DL_FRAME | ||
sed -i 's/oneflow as //g' ./scripts/$BENCHMARK_SCRIPT | ||
sed -i 's/OneFlow//g' ./scripts/$BENCHMARK_SCRIPT | ||
sed -i 's/torch.mock_torch.enable()//g' ./scripts/$BENCHMARK_SCRIPT | ||
sed -i 's/from onediff import OneFlowStableDiffusionPipeline/from diffusers import StableDiffusionPipeline/g' ./scripts/$BENCHMARK_SCRIPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一步看看git checkout可以做到不
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果这里使用git checkout的话,要再添加一句计算显存的
sed -i '/for r in range(repeat):/a\
cmd = "nvidia-smi --query-gpu=timestamp,name,driver_version,utilization.gpu,utilization.memory,memory.total,memory.free,memory.used --format=csv" \
os.system(cmd)' ./scripts/$BENCHMARK_SCRIPT
那我采用这个修改方式吧
modify run_benchmark.sh