本地安装 妙鸭开源版 facechain 记录(实战--打怪升级!)

本文讲述了作者在安装FaceChain项目时遇到的挑战,如版本冲突、环境变量设置等,并分享了逐步解决这些问题的方法。
摘要由CSDN通过智能技术生成

1.cmd进入你想安装的路径
输入git clone https://github.com/modelscope/facechain.git
等待下载(可能需要魔法)
2.创建环境(阅读文档,先创建环境)
命令行输入conda create -n facechain python=3.8
上来就报错:

CustomValidationError: Parameter channel_priority = 'strict' declared in <<merged>> is invalid.
The value 'strict' cannot be boolified.

解决方法:

打开C盘用户路径下的.condarc,里面有三行,最后一行的strict改为flexible、disabled都还是不行
直接把第三行注释掉,ok 解决了

在这里插入图片描述
创建成功:
在这里插入图片描述
接着按照命令执行就可:
在这里插入图片描述
执行pip3 install -r requirements.txt
过程中卡了一会儿,之后一直在下载,全程接近一个小时
当前的版本要下载的东西太多了,慢慢等吧
在这里插入图片描述

下载结束:
在这里插入图片描述

继续进行下一步:pip3 install -U openmim,很快就好了
在这里插入图片描述
继续 :mim install mmcv-full==1.7.2
在这里插入图片描述
继续执行python3 app.py,无返回结果,使用python app.py
运行过程报错在这里插入图片描述
这个错误 我试了很多办法,最后都不起作用,第二天决定直接从头再来!
创建环境名face,(第一次创建使用的python3.8,这次改成3.10了

conda create -n face python=3.10

之后重复上面的步骤。
最后运行python app.py
报错:AttributeError: module 'gradio' has no attribute 'Box'
解决办法:gradio 版本不对,卸载装新的:

pip uninstall gradio
pip install gradio==3.4

重新执行python app.py
报错:

TypeError: AsyncConnectionPool.init() got an unexpected keyword
argument ‘socket_options’

解决办法,pip install -U httpx==0.24.1
再次执行python app.py:
报错

AttributeError: module ‘gradio’ has no attribute ‘SelectData’

还是gradio的错误,把gradio又重装了好几个版本,还是不行,最后在github找到一个解决办法

pip install -i https://pypi.org/simple gradio==3.25.0

原来的错误解决了,继续python app.py,又报错:

types = api_info.get(“serialized_input”, [api_info[“info”][“type”]] *
2) # type: ignore KeyError: ‘type’

真搞笑,gradio版本还不对,再次卸载了,装3.36.1版本的

pip install gradio==3.36.1

再次执行python app.py !!! 终于出来网址了!!!
在这里插入图片描述
但仍然有报错:

Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps:

在这里插入图片描述
按照提示1 2 3去下载文件frpc_windows amd64.exe,并且放到指定文件夹下,重命名一下
重启app.py
真的醉了,还是不行,发现windows一直有弹窗提示,打开之后赋个权限,接下来还是不对
后来去问了一下AI,恍然大悟!!!
这个文件直接命名为frpc_windows_amd64_v0.2,不要有.exe
在这里插入图片描述
接下来继续python app.py
!!!报错没有了!!!
在这里插入图片描述
点击跳转网页:
长这个样:
在这里插入图片描述
问题它又来了,此时点击上传图片没反应,百度了一下,可能还是gradio版本的问题。。。

于是我又卸载了gradio 3.36.1,下载 pip install gradio ==3.50.2

OK 了!!
终于能上传图片了!!!!!
下一步,开始训练,点击开始训练,终端报错:
在这里插入图片描述
CUDA不可用,好 我去下载一个
在这里插入图片描述
时隔一天,OK,cuda安装好了,继续python app.py
又报错

ModuleNotFoundError: No module named ‘chardet’

在这里插入图片描述
没有就去下载:pip install chardet,下载成功接着python app.py
在这里插入图片描述
还是不对,时隔一天,咋网址都出不来了。。。

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous,since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

解决办法:打开app.py编辑一下在 全文开头加上下面这两句,ok 解决了

import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

继续执行python app.py
又报错:

SyntaxError: Non-UTF-8 code starting with ‘\xe5’ in file D:\Liuyin\work\MiaoYa\facechain\app.py on line 252, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details

是不是感觉似曾相识(因为在第一次安装时也遇到过,忘记记录下来了,因为实在解决不了开头的那个问题就直接重装了)在这里插入图片描述
解决办法:打开app.py再加上# coding=gb2312
继续执行!好啦!网址出来了
在这里插入图片描述
进来了!在这里插入图片描述
上传图片,点击开始训练,查看终端,开始训练了,接下来就是等待了!!!
在这里插入图片描述
在这里插入图片描述
下面有一些failed 暂时没有error,先等一下 再说
要下载好多东西:
在这里插入图片描述
下载结束之后,又有问题–且训练失败:
在这里插入图片描述
这个时候我有点蒙了,于是重新开始训练person2看是否会发生同样的错误,仍然报错
之后我重启了一下app.py
再次进行person3的训练,这时候报错不同了,变成了

ModuleNotFoundError: DamoFdDetect: No module named ‘mmcv’

好吧,那就退出下载:
pip install mmcv-full
下载报错:

  OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
  [end of output]

没有配置CUDA的环境变量
好 我去配置
在这里插入图片描述
配置好了,重新下载mmcv-full

继续python app.py
进入网页,上传图片并开始训练:
在这里插入图片描述
在这里插入图片描述
就在我以为他还是会报错的时候,他出来了!step!!出来了!!!,那我就等等吧 哈哈哈哈哈哈
在这里插入图片描述
训练好啦!好快的!这个只有3M的BIN文件,就是他了
在这里插入图片描述
接下来,进入网页端,选择无限风格形象写真:
在这里插入图片描述
有一些是默认的,先不去改
在这里插入图片描述
先生成3张图片试一下
在这里插入图片描述
要等一会,会下载很多东西:
在这里插入图片描述
下载的快慢跟网络有很大关系
在这里插入图片描述
等了好久,报错了,应该是没有tensorflow,好吧 去下载一下pip install tensorflow
在这里插入图片描述
下载好之后又报了个错:
在这里插入图片描述

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
mediapipe 0.10.11 requires protobuf<4,>=3.11, but you have protobuf 4.25.3 which is incompatible.
解决办法:

pip uninstall protobuf  
pip install protobuf==3.20.3

安装好之后,继续python app.py
进入网页,按上面的步骤开始训练!成功生成图片(有一种神似的感觉,虽然不是特别像吧)
OK!完结撒花!!!🌸🌸🌸
在这里插入图片描述

  • 10
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是一个简单的主角打怪升级的代码示例,使用Python语言实现: ```python import random player_level = 1 player_exp = 0 player_max_exp = 10 player_hp = 100 player_max_hp = 100 player_attack = 10 monster_level = 1 monster_hp = 50 monster_max_hp = 50 monster_attack = 5 print("你遇到了一个等级为", monster_level, "的怪物,准备战斗!") while player_hp > 0 and monster_hp > 0: # 玩家击怪物 damage = random.randint(player_attack - 2, player_attack + 2) monster_hp -= damage print("你攻击了怪物,造成了", damage, "点伤害。怪物剩余血量:", monster_hp) # 怪物攻击玩家 damage = random.randint(monster_attack - 2, monster_attack + 2) player_hp -= damage print("怪物攻击了你,造成了", damage, "点伤害。你剩余血量:", player_hp) # 判断战斗结果 if player_hp <= 0: print("你被怪物击败了,游戏结束。") break if monster_hp <= 0: print("你击败了怪物,获得了", monster_level * 10, "点经验值。") player_exp += monster_level * 10 if player_exp >= player_max_exp: player_level += 1 player_max_exp *= 2 player_hp = player_max_hp player_attack += 5 print("恭喜你升级了!当前等级为", player_level, ",最大生命值增加到", player_max_hp, ",攻击力增加到", player_attack, "。") # 生成新的怪物 monster_level += 1 monster_max_hp *= 2 monster_hp = monster_max_hp monster_attack += 5 print("你遇到了一个等级为", monster_level, "的怪物,准备战斗!") ``` 在这个代码中,玩家和怪物都有等级、生命值、攻击力等属性。玩家和怪物每次攻击都会随机产生一定的伤害值,直到一方的生命值降为0为止。如果玩家胜利,就会获得一定的经验值,并有可能升级升级后,玩家的属性会得到提升,同时会生成一个等级更高的新怪物。如果玩家失败,则游戏结束。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LuckyInn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值