Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| import coremltools as ct | ||
| import librosa | ||
| import numpy as np | ||
| import torch | ||
|
|
||
| from parakeet_components import CoreMLModelBundle | ||
|
|
||
| LOGGER = logging.getLogger("parakeet_streaming") |
There was a problem hiding this comment.
[P1] Import depends on missing module
The script imports CoreMLModelBundle from parakeet_components, but that module is not part of this repository and the dependency is not declared in the new pyproject.toml. Running the script as written will immediately raise ModuleNotFoundError, so streaming inference cannot even start. Consider either adding the module to the repo or switching to a relative import that points at the code that actually defines the bundle.
Useful? React with 👍 / 👎.
| def _predict_decoder(self, labels: torch.Tensor, h_in: np.ndarray, c_in: np.ndarray) -> tuple[torch.Tensor, np.ndarray, np.ndarray]: | ||
| outputs = self.decoder_model.predict( | ||
| { | ||
| "targets": np.array([labels.cpu().numpy()], dtype=np.int32), | ||
| "target_lengths": np.array([labels.numel()], dtype=np.int32), | ||
| "h_in": h_in, | ||
| "c_in": c_in, | ||
| } | ||
| ) | ||
| decoder_output = torch.from_numpy(outputs["decoder_output"]).to(self.device) | ||
| return decoder_output, outputs["h_out"], outputs["c_out"] | ||
|
|
||
| def _predict_joint(self, encoder_frame: torch.Tensor, decoder_output: torch.Tensor) -> torch.Tensor: | ||
| outputs = self.joint_model.predict( | ||
| { | ||
| "encoder_outputs": encoder_frame.unsqueeze(1).cpu().numpy().astype(np.float32), | ||
| "decoder_outputs": decoder_output.cpu().numpy().astype(np.float32), | ||
| } |
There was a problem hiding this comment.
[P1] Decoder and joint calls use wrong CoreML I/O names
The CoreML conversion code exports the decoder inputs as targets, target_length, h_in, c_in and outputs decoder, h_out, c_out, while the joint inputs are named encoder and decoder. Here the streaming decoder passes target_lengths, decoder_output, encoder_outputs, and decoder_outputs when invoking predict. Those keys do not exist in the exported models, so the first call to predict will raise a key error and decoding never proceeds. Update the dictionaries to use the actual names produced by the converter.
Useful? React with 👍 / 👎.
No description provided.