简体   繁体   中英

Is there a way to reset google colab forms to a default value?

I really like the new colabs forms feature for rapidly changing values and seeing how they effect the output.

When I create a form:

lead_mm_per_turn = 1.32 #@param {type:"slider", min:0, max:5, step:0.01}

Then change the slider value: 滑块调整

It changes the value in code:

lead_mm_per_turn = 2.22 #@param {type:"slider", min:0, max:5, step:0.01}

Restarting the runtime retains this value. Is there a way to reset the form to a default value?

I don't know how to do what you want specifically, but I've run into a similar problem.

In my case, I added a boolean checkbox, which overrides the values if set to true. Ex:

#@title {run: 'auto'}

default = False #@param {type: 'boolean'}
if default:
  MAX_LEN = 69
  temperature = 1.1
  top_p = 0.9
  repetition_penalty = 1.4
else:
  MAX_LEN = 44 #@param {type: 'slider', min:0, max:96, step:1}
  temperature = 0.7 #@param {type:"slider", min:0, max:5, step:0.1}
  top_p = 1.7 #@param {type:"slider", min:0, max:5, step:0.1}
  repetition_penalty = 1.1 #@param {type:"slider", min:0, max:5, step:0.1}

#num_beams = 4 #@param {type: 'slider', min:1, max:100, step:1}
#top_k = 4 #@param {type: 'slider', min:1, max:100, step:1}

It's not perfect. It doesn't actually changed the visual sliders, but the values of MAX_LEN / temperature / ... are changed.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM