Skip to content

Commit

Permalink
trying to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adefossez committed Sep 17, 2024
1 parent 8687712 commit 8db6d58
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ repos:
language: system
entry: bash -c 'cd moshi && flake8'
pass_filenames: false
hooks:
- id: pyright-moshi
name: pyrgith on moshi package
language: system
entry: bash -c 'cd moshi && pyright'
pass_filenames: false

8 changes: 4 additions & 4 deletions moshi/moshi/modules/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ def __init__(
context=context,
rope=rope,
weights_per_step=weights_per_step,
**attn_kwargs,
**factory_kwargs,
**attn_kwargs, # type: ignore
**factory_kwargs, # type: ignore
) # type: ignore
self.norm1 = create_norm_fn(norm, d_model, **factory_kwargs)
self.norm2 = create_norm_fn(norm, d_model, **factory_kwargs)
Expand Down Expand Up @@ -539,8 +539,8 @@ def __init__(
self.layer_scale_1 = nn.Identity()
self.layer_scale_2 = nn.Identity()
else:
self.layer_scale_1 = LayerScale(d_model, layer_scale, **factory_kwargs)
self.layer_scale_2 = LayerScale(d_model, layer_scale, **factory_kwargs)
self.layer_scale_1 = LayerScale(d_model, layer_scale, **factory_kwargs) # type: ignore
self.layer_scale_2 = LayerScale(d_model, layer_scale, **factory_kwargs) # type: ignore

def _init_streaming_state(self, batch_size: int) -> _LayerState:
return _LayerState(offset_cpu=0)
Expand Down
4 changes: 2 additions & 2 deletions moshi/moshi/quantization/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ def num_codebooks(self) -> int:
raise NotImplementedError()

@property
def semantic_quantizer(self):
def semantic_quantizer(self) -> 'BaseQuantizer':
"""This returns the quantizer that models the first level of the hierarchy (typically semantic).
In this case, it's the quantizer itself.
"""
return self

@property
def acoustic_quantizer(self):
def acoustic_quantizer(self) -> 'BaseQuantizer':
"""This returns the quantizer that models the higher levels of the hierarchy (typically acoustic).
In this case, it's the quantizer itself.
Expand Down
4 changes: 2 additions & 2 deletions moshi/moshi/quantization/vq.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,12 @@ def dimension(self):
return self.rvq_first.dimension

@property
def semantic_quantizer(self):
def semantic_quantizer(self) -> ResidualVectorQuantizer:
"""This returns the quantizer that models the first level of the hierarchy (typically semantic)."""
return self.rvq_first

@property
def acoustic_quantizer(self):
def acoustic_quantizer(self) -> ResidualVectorQuantizer:
"""This returns the quantizer that models the higher levels of the hierarchy (typically acoustic)."""
return self.rvq_rest

Expand Down

0 comments on commit 8db6d58

Please sign in to comment.