Giter VIP home page Giter VIP logo

Comments (8)

BrikerMan avatar BrikerMan commented on May 18, 2024

模型加载后先调用一次 predict 方法,然后在调用 app.run 启动 flask 即可。

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

@BinNong 请问问题解决了么?

from kashgari.

BinNong avatar BinNong commented on May 18, 2024

@BinNong 请问问题解决了么?

现在是可以predict,但是通过http接口调用重新训练的时候还是出问题

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

没太明白,你的需求是通过请求控制什么时候开始训练? 可以提供 demo 代码和具体的错误么?

from kashgari.

BinNong avatar BinNong commented on May 18, 2024

没太明白,你的需求是通过请求控制什么时候开始训练? 可以提供 demo 代码和具体的错误么?

    bert_embedding = BERTEmbedding('bert-base-chinese', sequence_length=512)
    classifier = CNNLSTMModel(bert_embedding)
    classifier.fit(texts, labels, epochs=2)

报错的地方是Fetch argument <tf.Variable 'Embedding-Token/embeddings:0' shape=(21128, 768) dtype=float32_ref> cannot be interpreted as a Tensor. (Tensor Tensor("Embedding-Token/embeddings:0", shape=(21128, 768), dtype=float32_ref) is not an element of this graph.)

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

麻烦贴一下 flask 的代码

from kashgari.

BinNong avatar BinNong commented on May 18, 2024

麻烦贴一下 flask 的代码
在flask里面设置路由
@app.route('/manage/model/rebuild')
def model_rebuild():
...
build() (这里会起一个新的线程,执行代码是上面那一段classifier)
....
app启动后,第一次调用rebuild是可以训练的,但是第二次调用的时候就错出了,是不是session的问题呢

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

可能是,没有做过类似的需求,如果可以提供个小 demo,然后我们一起解决看看。

from kashgari.

Related Issues (20)

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.