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

fix various typos (code & comments) #217

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
site_name: Refiners
site_decription: A micro framework on top of PyTorch with first class citizen APIs for foundation model adaptation
site_description: A micro framework on top of PyTorch with first class citizen APIs for foundation model adaptation
repo_name: Refiners
repo_url: https://github.com/finegrain-ai/refiners
edit_uri: edit/main/docs/
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare_test_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def convert_sam():
"convert_segment_anything.py",
"tests/weights/sam_vit_h_4b8939.pth",
"tests/weights/segment-anything-h.safetensors",
expected_hash="3b73b2fd",
expected_hash="b62ad5ed",
)


Expand Down
2 changes: 1 addition & 1 deletion src/refiners/fluxion/layers/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def find_state_dict_key(module: Module, /) -> str | None:
@staticmethod
def _pretty_print_args(*args: Any) -> str:
"""
Flatten nested tuples and print tensors with their shape and other informations.
Flatten nested tuples and print tensors with their shape and other information.
"""

def _flatten_tuple(t: Tensor | tuple[Any, ...], /) -> list[Any]:
Expand Down
6 changes: 3 additions & 3 deletions src/refiners/foundationals/latent_diffusion/image_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def convert_to_grid_features(clip_image_encoder: CLIPImageEncoderH) -> CLIPImage
assert isinstance(encoder_clone[-3], fl.Lambda) # pooling (classif token)
for _ in range(3):
encoder_clone.pop()
transfomer_layers = encoder_clone[-1]
assert isinstance(transfomer_layers, fl.Chain) and len(transfomer_layers) == 32
transfomer_layers.pop()
transformer_layers = encoder_clone[-1]
assert isinstance(transformer_layers, fl.Chain) and len(transformer_layers) == 32
transformer_layers.pop()
return encoder_clone
4 changes: 2 additions & 2 deletions src/refiners/foundationals/segment_anything/mask_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from refiners.fluxion.context import Contexts
from refiners.foundationals.segment_anything.transformer import (
SparseCrossDenseAttention,
TwoWayTranformerLayer,
TwoWayTransformerLayer,
)


Expand Down Expand Up @@ -210,7 +210,7 @@ def __init__(
EmbeddingsAggregator(num_output_mask=num_output_mask),
Transformer(
*(
TwoWayTranformerLayer(
TwoWayTransformerLayer(
embedding_dim=embedding_dim,
num_heads=8,
feed_forward_dim=feed_forward_dim,
Expand Down
2 changes: 1 addition & 1 deletion src/refiners/foundationals/segment_anything/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(
)


class TwoWayTranformerLayer(fl.Chain):
class TwoWayTransformerLayer(fl.Chain):
def __init__(
self,
embedding_dim: int,
Expand Down
2 changes: 1 addition & 1 deletion src/refiners/training_utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ModelConfig(BaseModel):

class GyroDropoutConfig(BaseModel):
total_subnetworks: int = 512
concurent_subnetworks: int = 64
concurrent_subnetworks: int = 64
iters_per_epoch: int = 512
num_features_threshold: float = 5e5

Expand Down
4 changes: 2 additions & 2 deletions src/refiners/training_utils/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def time_elapsed(self) -> int:
return int(time.time() - self.start_time)

@cached_property
def evalution_interval_steps(self) -> int:
def evaluation_interval_steps(self) -> int:
return self.convert_time_unit_to_steps(
number=self.evaluation_interval["number"], unit=self.evaluation_interval["unit"]
)
Expand Down Expand Up @@ -244,7 +244,7 @@ def done(self) -> bool:

@property
def is_evaluation_step(self) -> bool:
return self.step % self.evalution_interval_steps == 0
return self.step % self.evaluation_interval_steps == 0

@property
def is_checkpointing_step(self) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions tests/foundationals/segment_anything/test_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from refiners.fluxion.utils import image_to_tensor, load_tensors, no_grad
from refiners.foundationals.segment_anything.image_encoder import FusedSelfAttention
from refiners.foundationals.segment_anything.model import SegmentAnythingH
from refiners.foundationals.segment_anything.transformer import TwoWayTranformerLayer
from refiners.foundationals.segment_anything.transformer import TwoWayTransformerLayer

# See predictor_example.ipynb official notebook
PROMPTS: list[SAMPrompt] = [
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_two_way_transformer(facebook_sam_h: FacebookSAM) -> None:
dense_positional_embedding = torch.randn(1, 64 * 64, 256, device=facebook_sam_h.device)
sparse_embedding = torch.randn(1, 3, 256, device=facebook_sam_h.device)

refiners_layer = TwoWayTranformerLayer(
refiners_layer = TwoWayTransformerLayer(
embedding_dim=256, feed_forward_dim=2048, num_heads=8, device=facebook_sam_h.device
)
facebook_layer = facebook_sam_h.mask_decoder.transformer.layers[1] # type: ignore
Expand Down