SPSA: tuning integers, raise C_curr to 0.50 to allow C_end below 0.50

Allows passing C_end as 0 for integer tunes for example, which ensures that no matter the iteration number, C_curr will be exactly 0.50. This is useful for tuning very small numbers which have great impact, like depths, or impactful but small weights.

The formula for C_curr is C_end x (total_iters/curr_iters)^Gamma, where Gamma is usually 0.101
This commit is contained in:
andrew committed 2024-02-28 17:59:57 -05:00
1 parent 86a395d08d
commit 9c838cba9b
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -241,7 +241,7 @@ def spsa_param_digest(workload):
param = workload.spsa['parameters'][name]
# C and R if we got a workload right now
c = param['c'] / c_compression
c = max(param['c'] / c_compression, 0.00 if param['float'] else 0.50)
r = param['a'] / r_compression / c ** 2
fstr = '%.4f' if param['float'] else '%d'
+1 -1
View File
@@ -276,7 +276,7 @@ def spsa_to_dictionary(test, workload):
}
# C & R are constants for a particular assignment, for all Permutations
spsa[name]['c'] = param['c'] / c_compression
spsa[name]['c'] = max(param['c'] / c_compression, 0.00 if param['float'] else 0.50)
spsa[name]['r'] = param['a'] / r_compression / spsa[name]['c'] ** 2
for f in range(permutations):
+3 -3
View File
@@ -252,11 +252,11 @@ def verify_spsa_inputs(errors, request, field):
if not (float(minimum) <= float(value) <= float(maximum)):
errors.append('Value must be within [Min, Max], for %s' % (name))
if float(c) <= 0.00:
errors.append('C must be > 0.00, for %s' % (name))
if data_type.strip() == 'float' and float(c) <= 0.00:
errors.append('C for floats must be > 0.00, for %s' % (name))
if float(r) <= 0.00:
errors.append('C must be > 0.00, for %s' % (name))
errors.append('R must be > 0.00, for %s' % (name))
except:
traceback.print_exc()