wenet icon indicating copy to clipboard operation
wenet copied to clipboard

context bias for each websocket request

Open anjul1008 opened this issue 11 months ago • 7 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.

anjul1008 avatar Mar 19 '24 09:03 anjul1008

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

anjul1008 avatar Mar 19 '24 09:03 anjul1008

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.

anjul1008 avatar Mar 19 '24 11:03 anjul1008

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

anjul1008 avatar Mar 19 '24 12:03 anjul1008

plz make a pr to enhance ?

Mddct avatar Mar 19 '24 12:03 Mddct

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.

anjul1008 avatar Mar 21 '24 11:03 anjul1008

@pengzhendong plz make some advice

Mddct avatar Mar 21 '24 12:03 Mddct

need to make major changes with shared context resources to non shared

LGTM

pengzhendong avatar Apr 16 '24 09:04 pengzhendong