huggingface / huggingface/transformers-mlinter

A few suggestions

Open
#39 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6
Forks
12
Avg merge
10h 28m
Merged PRs (30d)
19

Description

1. Saw a model that import `from transformers import ClipModel` right inside a `modeling_not_clip_model.py`, this also should be disallowed in TRF009
2. This shouldn't raise any issues as we are calling the base init_weights
```
# modular_my_model.py
def _init_weights(self, module):
PreTrainedModel._init_weights(module)
```

I am not planning to open a PR today, so @tarekziade if you want to add in patch :)
Otherwise I will collect bugs as I review models, and do a bigger batch

Contributor guide

Open the contributing guide

Research direction

Start by locating the implementation of rule TRF009 and review how it handles imports in modeling files and _init_weights definitions. Use the ClipModel import example and the modular_my_model.py snippet as regression cases; done means the invalid import is disallowed while the base PreTrainedModel._init_weights call raises no issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.