Back to Annotated Deep Learning Paper Implementations

CIFAR10 හි විශාල ආකෘතියක් පුහුණු කරන්න

docs/si/distillation/large.html

latest3.7 KB
Original Source

homedistillation

View code on Github

#

CIFAR10 හි විශාල ආකෘතියක් පුහුණු කරන්න

මෙය ආසවනයසඳහා CIFAR 10 හි විශාල ආකෘතියක් පුහුණු කරයි.

15importtorch.nnasnn1617fromlabmlimportexperiment,logger18fromlabml.configsimportoption19fromlabml\_nn.experiments.cifar10importCIFAR10Configs,CIFAR10VGGModel20fromlabml\_nn.normalization.batch\_normimportBatchNorm

#

වින්යාසකිරීම්

සියලුමදත්ත කට්ටල ආශ්රිත වින්යාසයන්, ප්රශස්තකරණය සහ පුහුණු ලූපයක් නිර්වචනය කරන අපි භාවිතා CIFAR10Configs කරමු.

23classConfigs(CIFAR10Configs):

#

30pass

#

CIFA-10වර්ගීකරණය සඳහා VGG විලාසිතාවේ ආකෘතිය

මෙය සාමාන්ය VGG විලාසිතාවේ ගෘහ නිර්මාණ ශිල්පයෙන්ලබා ගනී.

33classLargeModel(CIFAR10VGGModel):

#

සංවහනස්තරයක් සහ සක්රිය කිරීම් සාදන්න

40defconv\_block(self,in\_channels,out\_channels)-\>nn.Module:

#

44returnnn.Sequential(

#

හැලීම

46nn.Dropout(0.1),

#

සංවහනස්ථරය

48nn.Conv2d(in\_channels,out\_channels,kernel\_size=3,padding=1),

#

කණ්ඩායම්සාමාන්යකරණය

50BatchNorm(out\_channels,track\_running\_stats=False),

#

Reluසක්රිය

52nn.ReLU(inplace=True),53)

#

55def\_\_init\_\_(self):

#

ලබාදී ඇති සංවහන ප්රමාණ (නාලිකා) සහිත ආකෘතියක් සාදන්න

57super().\_\_init\_\_([[64,64],[128,128],[256,256,256],[512,512,512],[512,512,512]])

#

ආකෘතියසාදන්න

60@option(Configs.model)61def\_large\_model(c:Configs):

#

65returnLargeModel().to(c.device)

#

68defmain():

#

අත්හදාබැලීම සාදන්න

70experiment.create(name='cifar10',comment='large model')

#

වින්යාසයන්සාදන්න

72conf=Configs()

#

වින්යාසයන්පූරණය කරන්න

74experiment.configs(conf,{75'optimizer.optimizer':'Adam',76'optimizer.learning\_rate':2.5e-4,77'is\_save\_models':True,78'epochs':20,79})

#

ඉතිරිකිරීම/පැටවීම සඳහා ආකෘතිය සකසන්න

81experiment.add\_pytorch\_models({'model':conf.model})

#

ආකෘතියේපරාමිති ගණන මුද්රණය කරන්න

83logger.inspect(params=(sum(p.numel()forpinconf.model.parameters()ifp.requires\_grad)))

#

අත්හදාබැලීම ආරම්භ කර පුහුණු ලූපය ක්රියාත්මක කරන්න

85withexperiment.start():86conf.run()

#

90if\_\_name\_\_=='\_\_main\_\_':91main()

Trending Research Paperslabml.ai