Skip to content

swanandmhalagi/model_scale_factor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

model_scale_factor

How to run and expected output

This script will generate random FP32 numbers.

Convert to BF16 and generate FP32/BF16 matrix.

A random number will be selected from this matrix.

Multiply the random num with original FP32 number.

Convert this new number to a BF16 number.

python3 Scale_Factor_fp32tobf16_random_x.py

FP32 original : [4092.3193194674723, 2505.9268058152566, 1706.0569102745465, 144.1030379284266, 3050.374378814086, 16.44514466497382, 577.6853258323001, 3761.678554804227, 1384.4064085332661, 2860.8279614775174, 5053.088256742923, 4536.037611016472, 5263.94787058616, 4496.798587412006, 3770.718562903195, 5412.142605917127, 3510.2337371499466, 5317.512487538068, 1531.3184681871476, 4303.607284506597, 2601.1174795340753, 4067.2579250926624, 4964.640933927759, 716.9864599985227, 4729.826998325099, 3314.926112348186, 2457.8838912134565, 3557.357550906465, 1677.7911022245792, 1107.9073376972756, 193.07454163780662, 3502.1714547519136]

BF16 original : [4080.0, 2496.0, 1704.0, 144.0, 3040.0, 16.375, 576.0, 3760.0, 1384.0, 2848.0, 5024.0, 4512.0, 5248.0, 4480.0, 3760.0, 5408.0, 3504.0, 5312.0, 1528.0, 4288.0, 2592.0, 4064.0, 4960.0, 716.0, 4704.0, 3312.0, 2448.0, 3552.0, 1672.0, 1104.0, 193.0, 3488.0]

FP32 / BF16 : [1.003019441045949, 1.0039770856631638, 1.0012071069686306, 1.0007155411696291, 1.0034126246098967, 1.0042836436625233, 1.0029259129032988, 1.0004464241500604, 1.0002936477841518, 1.0045041999569935, 1.0057898600204862, 1.0053274847110973, 1.0030388472915701, 1.0037496846901799, 1.0028506816231901, 1.0007660144077528, 1.0017790345747564, 1.0010377423829193, 1.0021717723737877, 1.0036397585136654, 1.0035175461165413, 1.000801654796423, 1.0009356721628546, 1.0013777374281043, 1.0054904333174106, 1.000883488027834, 1.004037537260399, 1.0015083195119552, 1.0034635778855139, 1.0035392551605757, 1.000386226102625, 1.0040629170733697]

Random num : 1.0053274847110973

Randon num x FP32 original : [4114.121088074863, 2519.2770925603663, 1715.145902380296, 144.87074465981297, 3066.625201680341, 16.532755921748254, 580.762935573497, 3781.7188397930095, 1391.7818125086724, 2876.068978703369, 5080.008507174546, 4560.203282038125, 5291.991472386721, 4520.755213135328, 3790.807008396913, 5440.975712904429, 3528.934453716991, 5345.841454016496, 1539.4765439142357, 4326.534686517373, 2614.9748931380614, 4088.926179504683, 4991.089982599347, 720.8061944022287, 4755.025079344812, 3332.586330530138, 2470.978230065549, 3576.309318870826, 1686.7295086700958, 1113.8096971001703, 194.10314330648416, 3520.829219632746]

Output BF16 num: [4096.0, 2512.0, 1712.0, 144.0, 3056.0, 16.5, 580.0, 3776.0, 1384.0, 2864.0, 5056.0, 4544.0, 5280.0, 4512.0, 3776.0, 5440.0, 3520.0, 5344.0, 1536.0, 4320.0, 2608.0, 4080.0, 4960.0, 720.0, 4736.0, 3328.0, 2464.0, 3568.0, 1680.0, 1112.0, 194.0, 3520.0]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages