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

Move Core Components to Modeling Layers and Simplify Bounding Box Handling #2038

Closed
wants to merge 38 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
741b889
vit base
sineeli Nov 14, 2024
13dae08
Add vit backbone, classifier and preprocessor layers
sineeli Nov 15, 2024
b64b137
update args
sineeli Nov 15, 2024
429d635
add default args
sineeli Nov 15, 2024
6d69abc
correct build method
sineeli Nov 15, 2024
2e87884
fix build issues
sineeli Nov 15, 2024
bd3cce0
fix bugs
sineeli Nov 16, 2024
4232a06
Update backbone args and configs
sineeli Nov 18, 2024
32b08c5
correct position ids dtype
sineeli Nov 18, 2024
cc938c6
build token layer
sineeli Nov 18, 2024
78812de
token layer build
sineeli Nov 18, 2024
8a20465
assign correct dtype to TokenLayer
sineeli Nov 18, 2024
de754cc
fix build shape of token layer
sineeli Nov 18, 2024
84ba896
correct mlp dens var names
sineeli Nov 18, 2024
7a70e16
use default norm mean and std as per hugging face config
sineeli Nov 18, 2024
81e3021
correct position_ids
sineeli Nov 19, 2024
d3061d6
remove separate token layer
sineeli Nov 19, 2024
618e163
correct position ids
sineeli Nov 19, 2024
2338637
Checkpoint conversion script and minor changes
sineeli Nov 21, 2024
95e5868
correct flag type
sineeli Nov 21, 2024
9d2e5bd
correct key name
sineeli Nov 21, 2024
ac7d1d3
use flat list later we can extract in between layers if needed
sineeli Nov 21, 2024
8065c01
Add test cases and correct dtype polciy for model
sineeli Nov 21, 2024
a8be824
add proper docstrings
sineeli Nov 21, 2024
3f027a0
correct test cases
sineeli Nov 22, 2024
05acb70
use numpy for test data
sineeli Nov 25, 2024
521df6f
nit
sineeli Nov 25, 2024
ae2b800
nit
sineeli Nov 27, 2024
26c2224
Merge branch 'master' into sineeli/ViT
sineeli Dec 2, 2024
92149d5
add presets
sineeli Dec 2, 2024
0e09699
Merge branch 'master' of https://github.com/sineeli/keras-hub
sineeli Dec 10, 2024
72dc592
move nms, anchor_generator and box_matcher to modeling layers
sineeli Dec 12, 2024
fa65d24
move nms, anchor_generator and box_matcher to modeling layers
sineeli Dec 12, 2024
cf7533d
Merge branch 'sineeli/refactor-retinanet' of https://github.com/sinee…
sineeli Dec 13, 2024
c677a70
Remove bounding box utils and depedencies of the utils
sineeli Jan 8, 2025
d4c006b
remove api import
sineeli Jan 8, 2025
5ce8c52
Merge branch 'master' of https://github.com/sineeli/keras-hub
sineeli Jan 8, 2025
ff39950
Merge branch 'master' into sineeli/refactor-retinanet
sineeli Jan 8, 2025
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
Prev Previous commit
Next Next commit
correct position ids dtype
  • Loading branch information
sineeli committed Nov 18, 2024
commit 32b08c5bfecde6ad8e0c1c06a20859f2c1902ed9
11 changes: 9 additions & 2 deletions keras_hub/src/models/vit/vit_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,15 @@ def build(self, input_shape):
name="position_embedding",
)
self.position_embedding.build([1, self.num_positions])
self.position_ids = ops.expand_dims(
ops.arange(self.num_positions), axis=0
self.position_ids = self.add_weight(
shape=(1, self.num_positions),
initializer="zeros",
# Let the backend determine the int dtype. For example, tf
# requires int64 for correct device placement, whereas jax and torch
# don't.
dtype=int,
trainable=False,
name="position_ids",
)
self.built = True

Expand Down