Comments (8)
我这边是因为labels出现了三维array这种数据,所以我加了一个步骤,将其降维成一维就好了
def decode_text(labels, vocabs, end_token = '</s>'):
results = []
if isinstance(labels, list) == False and labels.ndim>1:
labels_one = labels.reshape(-1).astype(int)
for idx in labels_one:
word = vocabs[idx]
if word == end_token:
return ' '.join(results)
results.append(word)
return ' '.join(results)
for idx in labels:
word = vocabs[idx]
if word == end_token:
return ' '.join(results)
results.append(word)
return ' '.join(results)
from seq2seq-couplet.
同问
from seq2seq-couplet.
from seq2seq-couplet.
from seq2seq-couplet.
请问跑通了吗
from seq2seq-couplet.
word = vocabs[idx] 修改为
word = np.array(vocabs)[idx]
from seq2seq-couplet.
from seq2seq-couplet.
我这边是因为labels出现了三维array这种数据,所以我加了一个步骤,将其降维成一维就好了
def decode_text(labels, vocabs, end_token = '</s>'): results = [] if isinstance(labels, list) == False and labels.ndim>1: labels_one = labels.reshape(-1).astype(int) for idx in labels_one: word = vocabs[idx] if word == end_token: return ' '.join(results) results.append(word) return ' '.join(results) for idx in labels: word = vocabs[idx] if word == end_token: return ' '.join(results) results.append(word) return ' '.join(results)
我这边也是这个问题,跑起来了,就是不知道这样改有问题没
from seq2seq-couplet.
Related Issues (20)
- 再来一下,船尾拔钉,孔子生于舟末
- 三观很正 HOT 5
- 如何将训练好的模型迁移到服务器上呢 HOT 1
- 上联下联字数对不上? HOT 1
- 求大神们帮助^.^
- What are these??? HOT 5
- 好兄弟 HOT 1
- 小昭推特来的。。。百万坦克上广场。。。 HOT 1
- 饥鸡盗稻童筒打 HOT 1
- 很强大,但有些结果,情况不忍直视... HOT 1
- 作者你好,请教一下你的Demo的界面的相关代码,谢谢
- model.ckpl HOT 1
- self.eval_session.run()运算出来的结果维度有问题,会导致解码时代码报错 HOT 3
- FileNotFoundError: [Errno 2] No such file or directory: '/data/dl-data/couplet/vocabs' HOT 1
- 😱 HOT 4
- 这个还是挺难的吧,工整吗?可以作为样本吧 HOT 2
- 草!太有节目效果了! HOT 2
- 运行python couplet.py出现编码错误 HOT 2
- 上联是:苦有南唐后主,图有不知出处,人有英雄无数,钱权路上竞相逐,了却人生路。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seq2seq-couplet.