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

Hvt #146

Merged
merged 13 commits into from
Dec 28, 2021
Merged

Hvt #146

merged 13 commits into from
Dec 28, 2021

Conversation

jarygrace
Copy link
Collaborator

Code of HVT is released

@jarygrace jarygrace linked an issue Dec 27, 2021 that may be closed by this pull request
@jarygrace
Copy link
Collaborator Author

The code of HVT is released and models are in the 'models' folder.

Copy link
Collaborator

@xperzy xperzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also check the coding style in hvt.py


The official pytorch implementation is [here]().

This implementation is developed by [PaddleViT](https://github.com/zhuang-group/HVT).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the correct PaddleViT link and official implementation link

image_classification/HVT/config.py Show resolved Hide resolved
droppath=config.MODEL.DROPPATH)
return model

# from config import get_config
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unrelated code

def build_hvt(config):
"""build deit model using config"""
model = HVT(image_size=config.DATA.IMAGE_SIZE,
in_channels=config.MODEL.TRANS.IN_CHANNELS,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use correct code indent

from droppath import DropPath


def print_model_named_params(model):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unrelated/debug code

criterion_val = nn.CrossEntropyLoss()


# 5. Create Teacher model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove if not used


# STEP 5: Define optimizer and lr_scheduler
# set lr according to batch size and world size (hacked from Swin official code and modified for CSwin)
if config.TRAIN.LINEAR_SCALED_LR is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no LINEAR_SCALED_LR in config.py, please add this keyword in config.py

# See the License for the specific language governing permissions and
# limitations under the License.

"""DeiT training/validation using single GPU """
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeiT -> HvT

parser.add_argument('-pretrained', type=str, default=None)
parser.add_argument('-resume', type=str, default=None)
parser.add_argument('-last_epoch', type=int, default=None)
parser.add_argument('-teacher_model', type=str, default=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove if not used

# STEP 5: Create Teacher model
teacher_model = None

# STEP 6: Define optimizer and lr_scheduler
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use similar "if condition " as main_multi_gpu.py

jarygrace and others added 4 commits December 27, 2021 11:33
add argument -output for image_classification(close #142)
add missing world size for lr linear scale in main_multi_gpu
Copy link
Collaborator

@xperzy xperzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the .xxx files in the repo and correct the coding styles in hvt.py

@xperzy
Copy link
Collaborator

xperzy commented Dec 28, 2021

LGTM

@xperzy xperzy merged commit 036c36b into develop Dec 28, 2021
@xperzy xperzy deleted the hvt branch December 28, 2021 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement HVT model
3 participants