Code Monkey home page Code Monkey logo

Comments (7)

bobye avatar bobye commented on May 28, 2024

can you try python2.7?

I developed this code using python2.7 + tensorflow1.14. I was able to follow the README with no crashes.

Its behavior under python3.6 is unknown to me. I know the python2 will soon be deprecated. I will try to fix the issue for python3.5 or higher.

from batchnorm_prune.

zaf05 avatar zaf05 commented on May 28, 2024

python2.7的环境我还没尝试,python3.6是可以训练,就是到最后一次,训练完成开始剪枝的时候报错在collection.append(tf.py_func(lambda a, b: self.flow.get_channel_pruned(a, b),[tf.constant(varname), v], tf.bool)) 这儿,我很困惑。

from batchnorm_prune.

bobye avatar bobye commented on May 28, 2024

It may be the pickle library is incompatible between python 2 and 3. Will let you know if I figured out.

from batchnorm_prune.

zaf05 avatar zaf05 commented on May 28, 2024

谢谢你耐心指导,pickle我已经在导包时候,换成python3.x的写法,你可以试试,在python3.x环境中,是不是与我同样的问题,方便话传一份python3.x环境代码,再次感谢。

from batchnorm_prune.

zaf05 avatar zaf05 commented on May 28, 2024

Hi,我又调试了一遍在Graph.py文件中get_channel_pruned添加了 varname = str(varname, encoding="utf8"),因为在我python3.6环境中出现varname为二进制,
KeyError: b'g1b1c0/BatchNorm/gamma'这样的错误,经过转换后,现在代码可以完全运行,没有任何错误,不知道我改的对不对,谢谢。
代码如下:

def get_channel_pruned(self, varname, v):
varname = str(varname, encoding="utf8")
if len(self.edgename_map[varname]) == 2:
v_in, v_out = self.edgename_map[varname]
for i in range(v.shape[0]):
if v[i]:
v1 = v_in + "%d" % i
v2 = v_out + "
%d" % i
self.nodes[v1].o.remove(v2)
self.nodes[v2].i.remove(v1)

from batchnorm_prune.

bobye avatar bobye commented on May 28, 2024

from batchnorm_prune.

bobye avatar bobye commented on May 28, 2024

@zaf05 Hi, could you verify if you can run the latest commit?

from batchnorm_prune.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.