Update app.py
Browse files
app.py
CHANGED
@@ -13,11 +13,11 @@ REPO_NAME = 'schuler/experimental-JP47D21-KPhi-3-micro-4k-instruct'
|
|
13 |
|
14 |
# How to cache?
|
15 |
@spaces.GPU()
|
16 |
-
def load_model(
|
17 |
-
# tokenizer = AutoTokenizer.from_pretrained(
|
18 |
-
tokenizer = LlamaTokenizer.from_pretrained(
|
19 |
-
generator_conf = GenerationConfig.from_pretrained(
|
20 |
-
model = AutoModelForCausalLM.from_pretrained(
|
21 |
# model.to('cuda')
|
22 |
return tokenizer, generator_conf, model
|
23 |
|
|
|
13 |
|
14 |
# How to cache?
|
15 |
@spaces.GPU()
|
16 |
+
def load_model(local_repo_name):
|
17 |
+
# tokenizer = AutoTokenizer.from_pretrained(local_repo_name, trust_remote_code=True)
|
18 |
+
tokenizer = LlamaTokenizer.from_pretrained(local_repo_name, trust_remote_code=True)
|
19 |
+
generator_conf = GenerationConfig.from_pretrained(local_repo_name)
|
20 |
+
model = AutoModelForCausalLM.from_pretrained(local_repo_name, trust_remote_code=True, torch_dtype=torch.bfloat16, attn_implementation="eager")
|
21 |
# model.to('cuda')
|
22 |
return tokenizer, generator_conf, model
|
23 |
|