nmmursit commited on
Commit
ce487f8
·
verified ·
1 Parent(s): 86cca4a

Upload README

Browse files
Files changed (1) hide show
  1. README.md +38 -0
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Finetuned Model (Distributed Checkpoint)
2
+
3
+ Base Model: meta-llama/Llama-3.1-8B-Instruct
4
+ Dataset: newmindai/euro_hpc-legal
5
+ Training dtype: bf16
6
+ Checkpoint Type: Distributed/Sharded (requires loading with FSDP)
7
+
8
+ ## Loading Instructions
9
+
10
+ This model was saved using PyTorch Distributed Checkpointing and requires special loading:
11
+
12
+ ```python
13
+ import torch
14
+ from torch.distributed.checkpoint import load
15
+ from transformers import AutoModelForCausalLM, AutoTokenizer
16
+
17
+ # Load tokenizer
18
+ tokenizer = AutoTokenizer.from_pretrained("/gpfs/scratch/ehpc317/esavirdi/dual_precision_training/7Dec/lama3.1_8b_rowwise_with_gw_hp_4nodes/final_model")
19
+
20
+ # Load model architecture
21
+ model = AutoModelForCausalLM.from_pretrained(
22
+ "meta-llama/Llama-3.1-8B-Instruct",
23
+ torch_dtype=torch.bf16,
24
+ )
25
+
26
+ # Load sharded weights
27
+ checkpoint = {"model": model.state_dict()}
28
+ load(checkpoint, checkpoint_id="/gpfs/scratch/ehpc317/esavirdi/dual_precision_training/7Dec/lama3.1_8b_rowwise_with_gw_hp_4nodes/final_model/sharded")
29
+ model.load_state_dict(checkpoint["model"])
30
+
31
+ # Generate text
32
+ inputs = tokenizer("Your prompt here", return_tensors="pt")
33
+ outputs = model.generate(**inputs, max_length=100)
34
+ print(tokenizer.decode(outputs[0]))
35
+ ```
36
+
37
+ Note: For easier inference, consider converting this to a standard HuggingFace checkpoint
38
+ by loading and re-saving on a single GPU.