Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ def init_args():
|
|
| 41 |
args = load_hyperparam(args)
|
| 42 |
|
| 43 |
# args.tokenizer = Tokenizer(model_path=args.spm_model_path)
|
| 44 |
-
args.tokenizer = AutoTokenizer.from_pretrained("Linly-AI/
|
| 45 |
args.vocab_size = args.tokenizer.sp_model.vocab_size()
|
| 46 |
|
| 47 |
|
|
@@ -57,8 +57,8 @@ def init_model():
|
|
| 57 |
|
| 58 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 59 |
# model.to(device)
|
| 60 |
-
model = AutoModelForCausalLM.from_pretrained("Linly-AI/
|
| 61 |
-
|
| 62 |
print(torch.cuda.max_memory_allocated() / 1024 ** 3)
|
| 63 |
lm_generation = LmGeneration(model, args.tokenizer)
|
| 64 |
|
|
|
|
| 41 |
args = load_hyperparam(args)
|
| 42 |
|
| 43 |
# args.tokenizer = Tokenizer(model_path=args.spm_model_path)
|
| 44 |
+
args.tokenizer = AutoTokenizer.from_pretrained("Linly-AI/Chinese-LLaMA-2-7B-hf", use_fast=False, trust_remote_code=True)
|
| 45 |
args.vocab_size = args.tokenizer.sp_model.vocab_size()
|
| 46 |
|
| 47 |
|
|
|
|
| 57 |
|
| 58 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 59 |
# model.to(device)
|
| 60 |
+
model = AutoModelForCausalLM.from_pretrained("Linly-AI/Chinese-LLaMA-2-7B-hf", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)
|
| 61 |
+
print(model)
|
| 62 |
print(torch.cuda.max_memory_allocated() / 1024 ** 3)
|
| 63 |
lm_generation = LmGeneration(model, args.tokenizer)
|
| 64 |
|