Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] support on-the-fly training by loading pt model as nn.Module #2668

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

robin1001
Copy link
Collaborator

@robin1001 robin1001 commented Jan 7, 2025

For example, we can use it as

class SpeechLLM(nn.Module):
    def __init__(self, encoder, llm):
        self.encoder = encoder
        self.llm = llm

    def forward(self, speech, text, speech_len, text_len):
        speech_emb = self.encoder.encoder.forward(speech, speech_lens)
        text_emb = self.llm.get_input_embeddings()(text)
        # ...


import wenet
speech_encoder = wenet.load_model_pt(xxx)
llm = Llama3()
speech = SpeechLLM(encoder=speech_encoder, llm=llm)

@robin1001 robin1001 marked this pull request as draft January 7, 2025 09:07
@robin1001 robin1001 marked this pull request as ready for review January 7, 2025 09:31
@Mddct Mddct merged commit 6c09f6c into main Jan 8, 2025
6 checks passed
@Mddct Mddct deleted the binbin-cli-pt branch January 8, 2025 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants