Update app.py
Browse files
app.py
CHANGED
@@ -16,16 +16,16 @@ num_samples = 10 # number of samples to draw
|
|
16 |
max_new_tokens = 500 # number of tokens generated in each sample
|
17 |
temperature = 0.8 # 1.0 = no change, < 1.0 = less random, > 1.0 = more random, in predictions
|
18 |
top_k = 200 # retain only the top_k most likely tokens, clamp others to have 0 probability
|
19 |
-
seed = 1337
|
20 |
device = 'cpu' # examples: 'cpu', 'cuda', 'cuda:0', 'cuda:1', etc.
|
21 |
dtype = 'bfloat16' if torch.cuda.is_available() and torch.cuda.is_bf16_supported() else 'float16' # 'float32' or 'bfloat16' or 'float16'
|
22 |
compile = False # use PyTorch 2.0 to compile the model to be faster
|
23 |
#exec(open('configurator.py').read()) # overrides from command line or config file
|
24 |
# -----------------------------------------------------------------------------
|
25 |
def sample_from_trained_model(start="\n", init_from='resume', out_dir='out-shakespeare-char', num_samples=1,
|
26 |
-
max_new_tokens=500, temperature=0.8, top_k=200,
|
27 |
-
torch.manual_seed(seed)
|
28 |
-
torch.cuda.manual_seed(seed)
|
29 |
torch.backends.cuda.matmul.allow_tf32 = True # allow tf32 on matmul
|
30 |
torch.backends.cudnn.allow_tf32 = True # allow tf32 on cudnn
|
31 |
device_type = 'cuda' if 'cuda' in device else 'cpu' # for later use in torch.autocast
|
|
|
16 |
max_new_tokens = 500 # number of tokens generated in each sample
|
17 |
temperature = 0.8 # 1.0 = no change, < 1.0 = less random, > 1.0 = more random, in predictions
|
18 |
top_k = 200 # retain only the top_k most likely tokens, clamp others to have 0 probability
|
19 |
+
#seed = 1337
|
20 |
device = 'cpu' # examples: 'cpu', 'cuda', 'cuda:0', 'cuda:1', etc.
|
21 |
dtype = 'bfloat16' if torch.cuda.is_available() and torch.cuda.is_bf16_supported() else 'float16' # 'float32' or 'bfloat16' or 'float16'
|
22 |
compile = False # use PyTorch 2.0 to compile the model to be faster
|
23 |
#exec(open('configurator.py').read()) # overrides from command line or config file
|
24 |
# -----------------------------------------------------------------------------
|
25 |
def sample_from_trained_model(start="\n", init_from='resume', out_dir='out-shakespeare-char', num_samples=1,
|
26 |
+
max_new_tokens=500, temperature=0.8, top_k=200, device='cpu', compile=False):
|
27 |
+
#torch.manual_seed(seed)
|
28 |
+
#torch.cuda.manual_seed(seed)
|
29 |
torch.backends.cuda.matmul.allow_tf32 = True # allow tf32 on matmul
|
30 |
torch.backends.cudnn.allow_tf32 = True # allow tf32 on cudnn
|
31 |
device_type = 'cuda' if 'cuda' in device else 'cpu' # for later use in torch.autocast
|