wenet-e2e / wenet

Production First and Production Ready End-to-End Speech Recognition Toolkit

Home Page:https://wenet-e2e.github.io/wenet/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

context bias for each websocket request

anjul1008 opened this issue · comments

Hi All,

I'm trying to implement context biasing for each websocket request with user provided words.
i have made a few changes in wesocket_server.cc file to accept user context strings and score to build graph.
And graph bulding is perfomed in OnSpeechStart() method.

But looks graph is not updated with newly build graph, it remains same which is build while loading model from params.h.

here are the screenshots of code change:
Screenshot from 2024-03-19 14-56-25
Screenshot from 2024-03-19 14-54-53

Can anyone help me to resolve it, any help would be appreciated.

graph build successfully and memory location got updated.
Screenshot from 2024-03-19 15-12-55

Hi @pengzhendong

i have tried the other approach to, i have added a new method void ContextGraph::UpdateContextGraph(std::string on_request_context_words_, float on_request_context_score_, const std::shared_ptr<fst::SymbolTable>& unit_table) in
context_graph.h header file, which can be called from OnSpeechGraph() method in wesocket_server.cc.

but it leads to following compilation error:

Screenshot from 2024-03-19 17-05-11

Can you please suggest me the where i'm making mistake or better approach to handle request level context graph creation.

i have define it in cc file, now it's working as expected.
thanks

plz make a pr to enhance ?

Hi @Mddct,
i made changes as described above but the context graph is updated which is shared across active connections.
i'll working on it and need to make major changes with shared context resources to non shared websocket connection.

your guidance would be very helpful if you have time.

thank you.

@pengzhendong plz make some advice