Skip to content

Add EDSR model #201

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

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions .ci/docker/requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ruamel.yaml==0.17.32
sympy==1.12
timm==0.6.13
tomli==2.0.1
torchsr==1.0.4
transformers==4.31.0
zstd==1.5.5.1
pytest==7.2.0
Expand Down
1 change: 1 addition & 0 deletions examples/models/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ python_library(
"//caffe2:torch",
"//executorch/examples/models:model_base", # @manual
"//executorch/examples/models/deeplab_v3:dl3_model", # @manual
"//executorch/examples/models/edsr:edsr_model", # @manual
"//executorch/examples/models/emformer_rnnt:emformer_rnnt_model", # @manual
"//executorch/examples/models/inception_v3:ic3_model", # @manual
"//executorch/examples/models/inception_v4:ic4_model", # @manual
Expand Down
1 change: 1 addition & 0 deletions examples/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"add": ("toy_model", "AddModule"),
"add_mul": ("toy_model", "AddMulModule"),
"dl3": ("deeplab_v3", "DeepLabV3ResNet50Model"),
"edsr": ("edsr", "EdsrModel"),
"emformer_transcribe": ("emformer_rnnt", "EmformerRnntTranscriberModel"),
"emformer_predict": ("emformer_rnnt", "EmformerRnntPredictorModel"),
"emformer_join": ("emformer_rnnt", "EmformerRnntJoinerModel"),
Expand Down
11 changes: 11 additions & 0 deletions examples/models/edsr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

from .model import EdsrModel

__all__ = [
EdsrModel,
]
28 changes: 28 additions & 0 deletions examples/models/edsr/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

import logging

import torch

from torchsr.models import edsr_r16f64 # @manual

from ..model_base import EagerModelBase


class EdsrModel(EagerModelBase):
def __init__(self):
pass

def get_eager_model(self) -> torch.nn.Module:
logging.info("Loading edsr model")
m = edsr_r16f64(2, True)
logging.info("Loaded edsr model")
return m

def get_example_inputs(self):
tensor_size = (1, 3, 224, 224)
return (torch.randn(tensor_size),)
3 changes: 3 additions & 0 deletions install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ pip install --pre timm==${TIMM_VERSION}

TRANSFORMERS_VERSION=4.31.0
pip install --pre transformers==${TRANSFORMERS_VERSION}

TORCHSR_VERSION=1.0.4
pip install --pre torchsr==${TORCHSR_VERSION}