SpiketheCowboy commited on
Commit
77f24ac
1 Parent(s): 99660e9

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +6 -5
  2. requirements.txt +2 -1
app.py CHANGED
@@ -54,17 +54,18 @@ def apply_delta(base_model_path, target_model_path, delta_path):
54
 
55
  print(f"Saving the target model to {target_model_path}")
56
  base.load_state_dict(target_weights)
57
- base.save_pretrained(target_model_path)
58
- delta_tokenizer.save_pretrained(target_model_path)
 
59
 
60
 
61
  base_weights = 'decapoda-research/llama-7b-hf'
62
  target_weights = 'expertllama' # local path
63
  delta_weights = 'OFA-Sys/expertllama-7b-delta'
64
- apply_delta(base_weights, target_weights, delta_weights)
65
 
66
- tokenizer = transformers.LlamaTokenizer.from_pretrained(expertllama_path)
67
- model = transformers.LlamaForCausalLM.from_pretrained(expertllama_path, torch_dtype=torch.float16, low_cpu_mem_usage=True)
68
  # model.cuda()
69
 
70
  with gr.Blocks() as demo:
 
54
 
55
  print(f"Saving the target model to {target_model_path}")
56
  base.load_state_dict(target_weights)
57
+ # base.save_pretrained(target_model_path)
58
+ # delta_tokenizer.save_pretrained(target_model_path)
59
+ return base, delta_tokenizer
60
 
61
 
62
  base_weights = 'decapoda-research/llama-7b-hf'
63
  target_weights = 'expertllama' # local path
64
  delta_weights = 'OFA-Sys/expertllama-7b-delta'
65
+ model, tokenizer = apply_delta(base_weights, target_weights, delta_weights)
66
 
67
+ # tokenizer = transformers.LlamaTokenizer.from_pretrained(expertllama_path)
68
+ # model = transformers.LlamaForCausalLM.from_pretrained(expertllama_path, torch_dtype=torch.float16, low_cpu_mem_usage=True)
69
  # model.cuda()
70
 
71
  with gr.Blocks() as demo:
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  torch
2
- transformers
 
 
1
  torch
2
+ transformers
3
+ SentencePiece