Skip to content

Commit 57d9da9

Browse files
committed
Update references
1 parent a1d6787 commit 57d9da9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+199
-195
lines changed

benchmarks/_models/llama/eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from tokenizer import get_tokenizer
1616

1717
import torchao
18-
from torchao._models.llama.model import prepare_inputs_for_model
18+
from benchmarks._models.llama.model import prepare_inputs_for_model
1919
from torchao.quantization import (
2020
PerRow,
2121
PerTensor,
@@ -172,7 +172,7 @@ def run_evaluation(
172172
if "autoround" in quantization:
173173
from transformers import AutoTokenizer
174174

175-
from torchao._models.llama.model import TransformerBlock
175+
from benchmarks._models.llama.model import TransformerBlock
176176
from torchao.prototype.autoround.autoround_llm import (
177177
quantize_model_with_autoround_,
178178
)

benchmarks/_models/llama/generate.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import torch._inductor.config
1515

1616
import torchao
17-
from torchao._models.utils import (
17+
from benchmarks._models.utils import (
1818
get_arch_name,
1919
write_json_result_local,
2020
write_json_result_ossci,
@@ -72,8 +72,8 @@ def device_sync(device):
7272
wd = Path(__file__).parent.parent.resolve()
7373
sys.path.append(str(wd))
7474

75-
from torchao._models.llama.model import Transformer, prepare_inputs_for_model
76-
from torchao._models.llama.tokenizer import get_tokenizer
75+
from benchmarks._models.llama.model import Transformer, prepare_inputs_for_model
76+
from benchmarks._models.llama.tokenizer import get_tokenizer
7777

7878

7979
def multinomial_sample_one_no_sync(
@@ -575,8 +575,8 @@ def ffn_or_attn_only(mod, fqn):
575575
model, float8_dynamic_activation_float8_weight(granularity=granularity)
576576
)
577577
elif "autoquant_v2" in quantization:
578+
from benchmarks._models.llama.model import prepare_inputs_for_model
578579
from torchao._eval import InputRecorder
579-
from torchao._models.llama.model import prepare_inputs_for_model
580580
from torchao.prototype.quantization.autoquant_v2 import autoquant_v2
581581

582582
calibration_seq_length = 256
@@ -665,8 +665,8 @@ def ffn_or_attn_only(mod, fqn):
665665
# do autoquantization
666666
model.finalize_autoquant()
667667
elif "autoquant" in quantization:
668+
from benchmarks._models.llama.model import prepare_inputs_for_model
668669
from torchao._eval import InputRecorder
669-
from torchao._models.llama.model import prepare_inputs_for_model
670670

671671
calibration_seq_length = 256
672672
inputs = (

benchmarks/_models/llama/perf_profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
import torch
117117
from torch.nn.attention import SDPBackend
118118

119-
from torchao._models.llama.model import Transformer
120-
from torchao._models.llama.tokenizer import get_tokenizer
119+
from benchmarks._models.llama.model import Transformer
120+
from benchmarks._models.llama.tokenizer import get_tokenizer
121121
from torchao.prototype.profiler import (
122122
CUDADeviceSpec,
123123
TransformerPerformanceCounter,

benchmarks/_models/sam/eval_combo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from metrics import calculate_miou, create_result_entry
1010

1111
import torchao
12-
from torchao._models.utils import (
12+
from benchmarks._models.utils import (
1313
get_arch_name,
1414
write_json_result_local,
1515
write_json_result_ossci,

benchmarks/_models/sam2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
from hydra.core.global_hydra import GlobalHydra
99

1010
if not GlobalHydra.instance().is_initialized():
11-
initialize_config_module("torchao._models.sam2", version_base="1.2")
11+
initialize_config_module("benchmarks._models.sam2", version_base="1.2")

benchmarks/_models/sam2/automatic_mask_generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import torch
1212
from torchvision.ops.boxes import batched_nms, box_area # type: ignore
1313

14-
from torchao._models.sam2.modeling.sam2_base import SAM2Base
15-
from torchao._models.sam2.sam2_image_predictor import SAM2ImagePredictor
16-
from torchao._models.sam2.utils.amg import (
14+
from benchmarks._models.sam2.modeling.sam2_base import SAM2Base
15+
from benchmarks._models.sam2.sam2_image_predictor import SAM2ImagePredictor
16+
from benchmarks._models.sam2.utils.amg import (
1717
MaskData,
1818
_mask_to_rle_pytorch_2_0,
1919
_mask_to_rle_pytorch_2_1,
@@ -33,7 +33,7 @@
3333
uncrop_masks,
3434
uncrop_points,
3535
)
36-
from torchao._models.sam2.utils.misc import (
36+
from benchmarks._models.sam2.utils.misc import (
3737
crop_image,
3838
get_image_size,
3939
)

benchmarks/_models/sam2/build_sam.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from hydra.utils import instantiate
1313
from omegaconf import OmegaConf
1414

15-
from torchao._models import sam2
15+
from benchmarks._models import sam2
1616

1717
# Check if the user is running Python from the parent directory of the sam2 repo
1818
# (i.e. the directory where this repo is cloned into) -- this is not supported since
@@ -106,7 +106,7 @@ def build_sam2_video_predictor(
106106
**kwargs,
107107
):
108108
hydra_overrides = [
109-
"++model._target_=torchao._models.sam2.sam2_video_predictor.SAM2VideoPredictor",
109+
"++model._target_=benchmarks._models.sam2.sam2_video_predictor.SAM2VideoPredictor",
110110
]
111111
if apply_postprocessing:
112112
hydra_overrides_extra = hydra_overrides_extra.copy()

benchmarks/_models/sam2/configs/sam2.1/sam2.1_hiera_b+.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
# Model
44
model:
5-
_target_: torchao._models.sam2.modeling.sam2_base.SAM2Base
5+
_target_: benchmarks._models.sam2.modeling.sam2_base.SAM2Base
66
image_encoder:
7-
_target_: torchao._models.sam2.modeling.backbones.image_encoder.ImageEncoder
7+
_target_: benchmarks._models.sam2.modeling.backbones.image_encoder.ImageEncoder
88
scalp: 1
99
trunk:
10-
_target_: torchao._models.sam2.modeling.backbones.hieradet.Hiera
10+
_target_: benchmarks._models.sam2.modeling.backbones.hieradet.Hiera
1111
embed_dim: 112
1212
num_heads: 2
1313
neck:
14-
_target_: torchao._models.sam2.modeling.backbones.image_encoder.FpnNeck
14+
_target_: benchmarks._models.sam2.modeling.backbones.image_encoder.FpnNeck
1515
position_encoding:
16-
_target_: torchao._models.sam2.modeling.position_encoding.PositionEmbeddingSine
16+
_target_: benchmarks._models.sam2.modeling.position_encoding.PositionEmbeddingSine
1717
num_pos_feats: 256
1818
normalize: true
1919
scale: null
@@ -24,17 +24,17 @@ model:
2424
fpn_interp_model: nearest
2525

2626
memory_attention:
27-
_target_: torchao._models.sam2.modeling.memory_attention.MemoryAttention
27+
_target_: benchmarks._models.sam2.modeling.memory_attention.MemoryAttention
2828
d_model: 256
2929
pos_enc_at_input: true
3030
layer:
31-
_target_: torchao._models.sam2.modeling.memory_attention.MemoryAttentionLayer
31+
_target_: benchmarks._models.sam2.modeling.memory_attention.MemoryAttentionLayer
3232
activation: relu
3333
dim_feedforward: 2048
3434
dropout: 0.1
3535
pos_enc_at_attn: false
3636
self_attention:
37-
_target_: torchao._models.sam2.modeling.sam.transformer.RoPEAttention
37+
_target_: benchmarks._models.sam2.modeling.sam.transformer.RoPEAttention
3838
rope_theta: 10000.0
3939
feat_sizes: [32, 32]
4040
embedding_dim: 256
@@ -45,7 +45,7 @@ model:
4545
pos_enc_at_cross_attn_keys: true
4646
pos_enc_at_cross_attn_queries: false
4747
cross_attention:
48-
_target_: torchao._models.sam2.modeling.sam.transformer.RoPEAttention
48+
_target_: benchmarks._models.sam2.modeling.sam.transformer.RoPEAttention
4949
rope_theta: 10000.0
5050
feat_sizes: [32, 32]
5151
rope_k_repeat: True
@@ -57,23 +57,23 @@ model:
5757
num_layers: 4
5858

5959
memory_encoder:
60-
_target_: torchao._models.sam2.modeling.memory_encoder.MemoryEncoder
60+
_target_: benchmarks._models.sam2.modeling.memory_encoder.MemoryEncoder
6161
out_dim: 64
6262
position_encoding:
63-
_target_: torchao._models.sam2.modeling.position_encoding.PositionEmbeddingSine
63+
_target_: benchmarks._models.sam2.modeling.position_encoding.PositionEmbeddingSine
6464
num_pos_feats: 64
6565
normalize: true
6666
scale: null
6767
temperature: 10000
6868
mask_downsampler:
69-
_target_: torchao._models.sam2.modeling.memory_encoder.MaskDownSampler
69+
_target_: benchmarks._models.sam2.modeling.memory_encoder.MaskDownSampler
7070
kernel_size: 3
7171
stride: 2
7272
padding: 1
7373
fuser:
74-
_target_: torchao._models.sam2.modeling.memory_encoder.Fuser
74+
_target_: benchmarks._models.sam2.modeling.memory_encoder.Fuser
7575
layer:
76-
_target_: torchao._models.sam2.modeling.memory_encoder.CXBlock
76+
_target_: benchmarks._models.sam2.modeling.memory_encoder.CXBlock
7777
dim: 256
7878
kernel_size: 7
7979
padding: 3

benchmarks/_models/sam2/configs/sam2.1/sam2.1_hiera_l.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
# Model
44
model:
5-
_target_: torchao._models.sam2.modeling.sam2_base.SAM2Base
5+
_target_: benchmarks._models.sam2.modeling.sam2_base.SAM2Base
66
image_encoder:
7-
_target_: torchao._models.sam2.modeling.backbones.image_encoder.ImageEncoder
7+
_target_: benchmarks._models.sam2.modeling.backbones.image_encoder.ImageEncoder
88
scalp: 1
99
trunk:
10-
_target_: torchao._models.sam2.modeling.backbones.hieradet.Hiera
10+
_target_: benchmarks._models.sam2.modeling.backbones.hieradet.Hiera
1111
embed_dim: 144
1212
num_heads: 2
1313
stages: [2, 6, 36, 4]
1414
global_att_blocks: [23, 33, 43]
1515
window_pos_embed_bkg_spatial_size: [7, 7]
1616
window_spec: [8, 4, 16, 8]
1717
neck:
18-
_target_: torchao._models.sam2.modeling.backbones.image_encoder.FpnNeck
18+
_target_: benchmarks._models.sam2.modeling.backbones.image_encoder.FpnNeck
1919
position_encoding:
20-
_target_: torchao._models.sam2.modeling.position_encoding.PositionEmbeddingSine
20+
_target_: benchmarks._models.sam2.modeling.position_encoding.PositionEmbeddingSine
2121
num_pos_feats: 256
2222
normalize: true
2323
scale: null
@@ -28,17 +28,17 @@ model:
2828
fpn_interp_model: nearest
2929

3030
memory_attention:
31-
_target_: torchao._models.sam2.modeling.memory_attention.MemoryAttention
31+
_target_: benchmarks._models.sam2.modeling.memory_attention.MemoryAttention
3232
d_model: 256
3333
pos_enc_at_input: true
3434
layer:
35-
_target_: torchao._models.sam2.modeling.memory_attention.MemoryAttentionLayer
35+
_target_: benchmarks._models.sam2.modeling.memory_attention.MemoryAttentionLayer
3636
activation: relu
3737
dim_feedforward: 2048
3838
dropout: 0.1
3939
pos_enc_at_attn: false
4040
self_attention:
41-
_target_: torchao._models.sam2.modeling.sam.transformer.RoPEAttention
41+
_target_: benchmarks._models.sam2.modeling.sam.transformer.RoPEAttention
4242
rope_theta: 10000.0
4343
feat_sizes: [32, 32]
4444
embedding_dim: 256
@@ -49,7 +49,7 @@ model:
4949
pos_enc_at_cross_attn_keys: true
5050
pos_enc_at_cross_attn_queries: false
5151
cross_attention:
52-
_target_: torchao._models.sam2.modeling.sam.transformer.RoPEAttention
52+
_target_: benchmarks._models.sam2.modeling.sam.transformer.RoPEAttention
5353
rope_theta: 10000.0
5454
feat_sizes: [32, 32]
5555
rope_k_repeat: True
@@ -61,23 +61,23 @@ model:
6161
num_layers: 4
6262

6363
memory_encoder:
64-
_target_: torchao._models.sam2.modeling.memory_encoder.MemoryEncoder
64+
_target_: benchmarks._models.sam2.modeling.memory_encoder.MemoryEncoder
6565
out_dim: 64
6666
position_encoding:
67-
_target_: torchao._models.sam2.modeling.position_encoding.PositionEmbeddingSine
67+
_target_: benchmarks._models.sam2.modeling.position_encoding.PositionEmbeddingSine
6868
num_pos_feats: 64
6969
normalize: true
7070
scale: null
7171
temperature: 10000
7272
mask_downsampler:
73-
_target_: torchao._models.sam2.modeling.memory_encoder.MaskDownSampler
73+
_target_: benchmarks._models.sam2.modeling.memory_encoder.MaskDownSampler
7474
kernel_size: 3
7575
stride: 2
7676
padding: 1
7777
fuser:
78-
_target_: torchao._models.sam2.modeling.memory_encoder.Fuser
78+
_target_: benchmarks._models.sam2.modeling.memory_encoder.Fuser
7979
layer:
80-
_target_: torchao._models.sam2.modeling.memory_encoder.CXBlock
80+
_target_: benchmarks._models.sam2.modeling.memory_encoder.CXBlock
8181
dim: 256
8282
kernel_size: 7
8383
padding: 3

benchmarks/_models/sam2/configs/sam2.1/sam2.1_hiera_s.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
# Model
44
model:
5-
_target_: torchao._models.sam2.modeling.sam2_base.SAM2Base
5+
_target_: benchmarks._models.sam2.modeling.sam2_base.SAM2Base
66
image_encoder:
7-
_target_: torchao._models.sam2.modeling.backbones.image_encoder.ImageEncoder
7+
_target_: benchmarks._models.sam2.modeling.backbones.image_encoder.ImageEncoder
88
scalp: 1
99
trunk:
10-
_target_: torchao._models.sam2.modeling.backbones.hieradet.Hiera
10+
_target_: benchmarks._models.sam2.modeling.backbones.hieradet.Hiera
1111
embed_dim: 96
1212
num_heads: 1
1313
stages: [1, 2, 11, 2]
1414
global_att_blocks: [7, 10, 13]
1515
window_pos_embed_bkg_spatial_size: [7, 7]
1616
neck:
17-
_target_: torchao._models.sam2.modeling.backbones.image_encoder.FpnNeck
17+
_target_: benchmarks._models.sam2.modeling.backbones.image_encoder.FpnNeck
1818
position_encoding:
19-
_target_: torchao._models.sam2.modeling.position_encoding.PositionEmbeddingSine
19+
_target_: benchmarks._models.sam2.modeling.position_encoding.PositionEmbeddingSine
2020
num_pos_feats: 256
2121
normalize: true
2222
scale: null
@@ -27,17 +27,17 @@ model:
2727
fpn_interp_model: nearest
2828

2929
memory_attention:
30-
_target_: torchao._models.sam2.modeling.memory_attention.MemoryAttention
30+
_target_: benchmarks._models.sam2.modeling.memory_attention.MemoryAttention
3131
d_model: 256
3232
pos_enc_at_input: true
3333
layer:
34-
_target_: torchao._models.sam2.modeling.memory_attention.MemoryAttentionLayer
34+
_target_: benchmarks._models.sam2.modeling.memory_attention.MemoryAttentionLayer
3535
activation: relu
3636
dim_feedforward: 2048
3737
dropout: 0.1
3838
pos_enc_at_attn: false
3939
self_attention:
40-
_target_: torchao._models.sam2.modeling.sam.transformer.RoPEAttention
40+
_target_: benchmarks._models.sam2.modeling.sam.transformer.RoPEAttention
4141
rope_theta: 10000.0
4242
feat_sizes: [32, 32]
4343
embedding_dim: 256
@@ -48,7 +48,7 @@ model:
4848
pos_enc_at_cross_attn_keys: true
4949
pos_enc_at_cross_attn_queries: false
5050
cross_attention:
51-
_target_: torchao._models.sam2.modeling.sam.transformer.RoPEAttention
51+
_target_: benchmarks._models.sam2.modeling.sam.transformer.RoPEAttention
5252
rope_theta: 10000.0
5353
feat_sizes: [32, 32]
5454
rope_k_repeat: True
@@ -60,23 +60,23 @@ model:
6060
num_layers: 4
6161

6262
memory_encoder:
63-
_target_: torchao._models.sam2.modeling.memory_encoder.MemoryEncoder
63+
_target_: benchmarks._models.sam2.modeling.memory_encoder.MemoryEncoder
6464
out_dim: 64
6565
position_encoding:
66-
_target_: torchao._models.sam2.modeling.position_encoding.PositionEmbeddingSine
66+
_target_: benchmarks._models.sam2.modeling.position_encoding.PositionEmbeddingSine
6767
num_pos_feats: 64
6868
normalize: true
6969
scale: null
7070
temperature: 10000
7171
mask_downsampler:
72-
_target_: torchao._models.sam2.modeling.memory_encoder.MaskDownSampler
72+
_target_: benchmarks._models.sam2.modeling.memory_encoder.MaskDownSampler
7373
kernel_size: 3
7474
stride: 2
7575
padding: 1
7676
fuser:
77-
_target_: torchao._models.sam2.modeling.memory_encoder.Fuser
77+
_target_: benchmarks._models.sam2.modeling.memory_encoder.Fuser
7878
layer:
79-
_target_: torchao._models.sam2.modeling.memory_encoder.CXBlock
79+
_target_: benchmarks._models.sam2.modeling.memory_encoder.CXBlock
8080
dim: 256
8181
kernel_size: 7
8282
padding: 3

0 commit comments

Comments
 (0)