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

Remove default mutable arguments from AbstractEmbModel constructor #11348

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 9 additions & 4 deletions nemo/collections/diffusion/encoders/conditioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Union
from typing import List, Optional, Union

import torch
import torch.nn as nn
from transformers import CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5Tokenizer


class AbstractEmbModel(nn.Module):
def __init__(self, enable_lora_finetune=False, target_block=[], target_module=[]):
def __init__(
self,
enable_lora_finetune: bool = False,
target_block: Optional[List[str]] = None,
target_module: Optional[List[str]] = None,
) -> None:
super().__init__()
self._is_trainable = None
self._ucg_rate = None
self._input_key = None

self.TARGET_BLOCK = target_block
self.TARGET_MODULE = target_module
self.TARGET_BLOCK = target_block or []
self.TARGET_MODULE = target_module or []
if enable_lora_finetune:
self.lora_layers = []

Expand Down
Loading