Upload folder using huggingface_hub
Browse files
README.md
CHANGED
@@ -36,12 +36,17 @@ tokenizer.save_pretrained(save_path)
|
|
36 |
model = transformers.AutoModelForCausalLM.from_config(config, torch_dtype=torch.bfloat16)
|
37 |
model.generation_config = transformers.GenerationConfig.from_pretrained(model_id)
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, do_sample=False, device='cuda')
|
40 |
print(pipe('Hello World!'))
|
41 |
|
42 |
model.save_pretrained(save_path)
|
43 |
|
44 |
os.system(f'ls -alh {save_path}')
|
45 |
-
|
46 |
-
|
47 |
```
|
|
|
36 |
model = transformers.AutoModelForCausalLM.from_config(config, torch_dtype=torch.bfloat16)
|
37 |
model.generation_config = transformers.GenerationConfig.from_pretrained(model_id)
|
38 |
|
39 |
+
transformers.set_seed(42)
|
40 |
+
with torch.no_grad():
|
41 |
+
for _, p in sorted(model.named_parameters()):
|
42 |
+
torch.nn.init.uniform_(p, -0.1, 0.1)
|
43 |
+
|
44 |
pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, do_sample=False, device='cuda')
|
45 |
print(pipe('Hello World!'))
|
46 |
|
47 |
model.save_pretrained(save_path)
|
48 |
|
49 |
os.system(f'ls -alh {save_path}')
|
50 |
+
create_repo(repo_id, exist_ok=True)
|
51 |
+
upload_folder(repo_id=repo_id, folder_path=save_path)
|
52 |
```
|