John6666 commited on
Commit
04f30d4
·
verified ·
1 Parent(s): 64e19e9

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -7,17 +7,16 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
7
 
8
  # Load the gated model
9
  #model_name = "RickyDeSkywalker/TheoremLlama"
10
- #model_name = "unsloth/Llama-3.2-1B-Instruct"
11
  device = "cuda" if torch.cuda.is_available() else "cpu"
12
  #model_name = "internlm/internlm2-math-plus-7b"
13
- model_name = "deepseek-ai/DeepSeek-Prover-V1.5-RL"
14
  HF_TOKEN = os.environ.get("HF_TOKEN")
15
  #login(HF_TOKEN)
16
 
17
  tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
18
  # Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
19
  model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, torch_dtype=torch.float16).eval().to(device)
20
- model = model.eval()
21
  terminators = [tokenizer.eos_token_id,
22
  tokenizer.convert_tokens_to_ids("<|eot_id|>"),
23
  tokenizer.convert_tokens_to_ids("<|reserved_special_token_26|>")]
 
7
 
8
  # Load the gated model
9
  #model_name = "RickyDeSkywalker/TheoremLlama"
10
+ model_name = "unsloth/Llama-3.2-1B-Instruct"
11
  device = "cuda" if torch.cuda.is_available() else "cpu"
12
  #model_name = "internlm/internlm2-math-plus-7b"
13
+ #model_name = "deepseek-ai/DeepSeek-Prover-V1.5-RL"
14
  HF_TOKEN = os.environ.get("HF_TOKEN")
15
  #login(HF_TOKEN)
16
 
17
  tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
18
  # Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
19
  model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, torch_dtype=torch.float16).eval().to(device)
 
20
  terminators = [tokenizer.eos_token_id,
21
  tokenizer.convert_tokens_to_ids("<|eot_id|>"),
22
  tokenizer.convert_tokens_to_ids("<|reserved_special_token_26|>")]