-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
name = "Boltz" | ||
uuid = "4544d5e4-abc5-4dea-817f-29e4c205d9c8" | ||
authors = ["Avik Pal <[email protected]> and contributors"] | ||
version = "0.1.3" | ||
version = "0.1.4" | ||
|
||
[deps] | ||
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" | ||
Flux2Lux = "ab51a4a6-c8c3-4b1f-af31-4b52a21037df" | ||
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" | ||
Lux = "b2108857-7c20-44ae-9111-449ecde12c47" | ||
Metalhead = "dbeba491-748d-5e0e-a39e-b530a07fa0cc" | ||
|
@@ -19,7 +20,8 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | |
CUDA = "3" | ||
ChainRulesCore = "1.15" | ||
JLD2 = "0.4" | ||
Lux = "0.4.26" # Boltz Needs some of the Newer Layers | ||
Flux2Lux = "0.1" | ||
Lux = "0.4.26" | ||
Metalhead = "0.7" | ||
NNlib = "0.8" | ||
julia = "1.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,87 @@ | ||
function alexnet(name::Symbol; kwargs...) | ||
function alexnet(name::Symbol; pretrained=false, kwargs...) | ||
assert_name_present_in(name, (:alexnet,)) | ||
model = Lux.transform(AlexNet().layers) | ||
return initialize_model(name, model; kwargs...) | ||
model = transform(AlexNet().layers) | ||
|
||
# Compatibility with pretrained weights | ||
if pretrained | ||
model = Chain(model[1], model[2]) | ||
end | ||
|
||
return _initialize_model(name, model; pretrained, kwargs...) | ||
end | ||
|
||
function resnet(name::Symbol; kwargs...) | ||
function resnet(name::Symbol; pretrained=false, kwargs...) | ||
assert_name_present_in(name, (:resnet18, :resnet34, :resnet50, :resnet101, :resnet152)) | ||
model = if name == :resnet18 | ||
Lux.transform(ResNet(18).layers) | ||
transform(ResNet(18).layers) | ||
elseif name == :resnet34 | ||
Lux.transform(ResNet(34).layers) | ||
transform(ResNet(34).layers) | ||
elseif name == :resnet50 | ||
Lux.transform(ResNet(50).layers) | ||
transform(ResNet(50).layers) | ||
elseif name == :resnet101 | ||
Lux.transform(ResNet(101).layers) | ||
transform(ResNet(101).layers) | ||
elseif name == :resnet152 | ||
Lux.transform(ResNet(152).layers) | ||
transform(ResNet(152).layers) | ||
end | ||
return initialize_model(name, model; kwargs...) | ||
|
||
# Compatibility with pretrained weights | ||
if pretrained | ||
model = Chain(model[1], model[2]) | ||
end | ||
|
||
return _initialize_model(name, model; pretrained, kwargs...) | ||
end | ||
|
||
function resnext(name::Symbol; kwargs...) | ||
assert_name_present_in(name, (:resnext50, :resnext101, :resnext152)) | ||
model = if name == :resnext50 | ||
Lux.transform(ResNeXt(50).layers) | ||
transform(ResNeXt(50).layers) | ||
elseif name == :resnext101 | ||
Lux.transform(ResNeXt(101).layers) | ||
transform(ResNeXt(101).layers) | ||
elseif name == :resnext152 | ||
Lux.transform(ResNeXt(152).layers) | ||
transform(ResNeXt(152).layers) | ||
end | ||
return initialize_model(name, model; kwargs...) | ||
return _initialize_model(name, model; kwargs...) | ||
end | ||
|
||
function googlenet(name::Symbol; kwargs...) | ||
assert_name_present_in(name, (:googlenet,)) | ||
model = Lux.transform(GoogLeNet().layers) | ||
return initialize_model(name, model; kwargs...) | ||
model = transform(GoogLeNet().layers) | ||
return _initialize_model(name, model; kwargs...) | ||
end | ||
|
||
function densenet(name::Symbol; kwargs...) | ||
assert_name_present_in(name, (:densenet121, :densenet161, :densenet169, :densenet201)) | ||
model = if name == :densenet121 | ||
Lux.transform(DenseNet(121).layers) | ||
transform(DenseNet(121).layers) | ||
elseif name == :densenet161 | ||
Lux.transform(DenseNet(161).layers) | ||
transform(DenseNet(161).layers) | ||
elseif name == :densenet169 | ||
Lux.transform(DenseNet(169).layers) | ||
transform(DenseNet(169).layers) | ||
elseif name == :densenet201 | ||
Lux.transform(DenseNet(201).layers) | ||
transform(DenseNet(201).layers) | ||
end | ||
return initialize_model(name, model; kwargs...) | ||
return _initialize_model(name, model; kwargs...) | ||
end | ||
|
||
function mobilenet(name::Symbol; kwargs...) | ||
assert_name_present_in(name, | ||
(:mobilenet_v1, :mobilenet_v2, :mobilenet_v3_small, | ||
:mobilenet_v3_large)) | ||
model = if name == :mobilenet_v1 | ||
Lux.transform(MobileNetv1().layers) | ||
transform(MobileNetv1().layers) | ||
elseif name == :mobilenet_v2 | ||
Lux.transform(MobileNetv2().layers) | ||
transform(MobileNetv2().layers) | ||
elseif name == :mobilenet_v3_small | ||
Lux.transform(MobileNetv3(:small).layers) | ||
transform(MobileNetv3(:small).layers) | ||
elseif name == :mobilenet_v3_large | ||
Lux.transform(MobileNetv3(:large).layers) | ||
transform(MobileNetv3(:large).layers) | ||
end | ||
return initialize_model(name, model; kwargs...) | ||
return _initialize_model(name, model; kwargs...) | ||
end | ||
|
||
function convmixer(name::Symbol; kwargs...) | ||
assert_name_present_in(name, (:base, :large, :small)) | ||
model = Lux.transform(ConvMixer(name).layers) | ||
return initialize_model(name, model; kwargs...) | ||
model = transform(ConvMixer(name).layers) | ||
return _initialize_model(name, model; kwargs...) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1be3bf7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register subdir=lib/Boltz
1be3bf7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/72387
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: