logo
Loading...

AttributeError: module 'tensorflow' has no attribute 'variable_scope' - Cupoy

創建實例時遇到錯誤 AttributeError: module 'tensorflow&#...

AttributeError: module 'tensorflow' has no attribute 'variable_scope'

2020/12/04 上午 10:03
使用 CkipTagger 進行中文斷詞
江姵璇
觀看數:397
回答數:2
收藏數:0

創建實例時遇到錯誤 ```python AttributeError: module 'tensorflow' has no attribute 'variable_scope' ``` 我的tensorflow是2.3.0,是否是版本問題?

回答列表

  • 2020/12/04 下午 07:33
    劉冠宏
    贊同數:0
    不贊同數:0
    留言數:0

    Hi 您好 應該不是tensorflow 2.3.0的問題,我這邊使用tensorflow 2.3.0搭配ckiptagger 0.2.1版本是可以正常運行。 ![Screenshot 2020-12-04 at 7.30.29 PM.png](http://kwassistfile.cupoy.com/000001762D831066000000026375706F795F72656C65617365414E53/1606789766810/large) ckiptagger 官方repo也有提到支援tensorflow 2.3.0 ![Screenshot 2020-12-04 at 7.28.46 PM.png](http://kwassistfile.cupoy.com/000001762D831066000000026375706F795F72656C65617365414E53/1606789766811/large) 你用的ckiptagger版本為何呢? 你可以嘗試看看從新安裝。

  • 2020/12/04 下午 11:27
    張維元 (WeiYuan)
    贊同數:0
    不贊同數:0
    留言數:0

    嗨,你好
    如果只是這個錯誤是版本的問題沒錯哦,在 TF2 要這樣用: ``` tf.compat.v1.variable_scope() ``` 可以參考這一篇討論。

    嗨,你好,我是維元,持續在不同的平台發表對 #資料科學、 #網頁開發 或 #軟體職涯 相關的文章。如果對於內文有疑問都歡迎與我們進一步的交流,都可以追蹤我的 Facebook技術部落格 ,也會不定時的舉辦分享活動,一起來玩玩吧 ヽ(●´∀`●)ノ