Seed has to be a 64-bit unsigned int or PyTorch will throw an error

tpu_mtj_backend's seed can be an integer of arbitrary size but we will
limit it to a 64-bit unsigned integer anyways for consistency.
This commit is contained in:
vfbd 2022-10-02 17:50:32 -04:00
parent dd1c25241d
commit bdfa6d86b7
2 changed files with 4 additions and 4 deletions

View File

@ -7478,7 +7478,7 @@ class GenerationInputSchema(SamplerSettingsSchema):
frmtadsnsp: Optional[bool] = fields.Boolean(metadata={"description": "Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.\n\nIf `disable_input_formatting` is `true`, this defaults to `false` instead of the value in the KoboldAI GUI."})
quiet: Optional[bool] = fields.Boolean(metadata={"description": "When enabled, Generated output will not be displayed in the console."})
sampler_order: Optional[List[int]] = fields.List(fields.Integer(), validate=[validate.Length(min=6), permutation_validator], metadata={"description": "Sampler order to be used. If N is the length of this array, then N must be greater than or equal to 6 and the array must be a permutation of the first N non-negative integers."})
sampler_seed: Optional[int] = fields.Integer(metadata={"description": "RNG seed to use for sampling. If not specified, the global RNG will be used."})
sampler_seed: Optional[int] = fields.Integer(validate=validate.Range(min=0, max=2**64 - 1), metadata={"description": "RNG seed to use for sampling. If not specified, the global RNG will be used."})
sampler_full_determinism: Optional[bool] = fields.Boolean(metadata={"description": "If enabled, the generated text will always be the same as long as you use the same RNG seed, input and settings. If disabled, only the *sequence* of generated texts that you get when repeatedly generating text will be the same given the same RNG seed, input and settings."})
class GenerationResultSchema(KoboldSchema):
@ -9881,7 +9881,7 @@ def put_config_soft_prompt(body: SoftPromptSettingSchema):
return {}
class SamplerSeedSettingSchema(KoboldSchema):
value: int = fields.Integer(required=True)
value: int = fields.Integer(validate=validate.Range(min=0, max=2**64 - 1), required=True)
@api_v1.get("/config/sampler_seed")
@api_schema_wrap

View File

@ -55,7 +55,7 @@ from mesh_transformer.util import to_bf16
params: Dict[str, Any] = {}
__seed = random.randrange(sys.maxsize)
__seed = random.randrange(2**64)
rng = random.Random(__seed)
@ -69,7 +69,7 @@ def set_rng_seed(seed: int):
return seed
def randomize_rng_seed():
return set_rng_seed(random.randrange(sys.maxsize))
return set_rng_seed(random.randrange(2**64))
def get_rng_state():
return rng