Mike0307 commited on
Commit
96610ae
·
verified ·
1 Parent(s): fc69a83

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -5
README.md CHANGED
@@ -9,6 +9,8 @@ datasets:
9
  language:
10
  - zh
11
  pipeline_tag: text-generation
 
 
12
  ---
13
 
14
 
@@ -36,8 +38,8 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
36
  model_id = "Mike0307/Phi-3-mini-4k-instruct-chinese-lora"
37
  model = AutoModelForCausalLM.from_pretrained(
38
  model_id,
39
- device_map="mps", # Change mps if not MacOS
40
- torch_dtype=torch.float32, # try float16 for M1 chip
41
  trust_remote_code=True,
42
  attn_implementation="eager", # without flash_attn
43
  )
@@ -53,7 +55,7 @@ input_text = "<|user|>將這五種動物分成兩組。\n老虎、鯊魚、大
53
  inputs = tokenizer(
54
  input_text,
55
  return_tensors="pt"
56
- ).to(torch.device("mps")) # Change mps if not MacOS
57
 
58
  outputs = model.generate(
59
  **inputs,
@@ -100,5 +102,4 @@ generated_text = tokenizer.decode(
100
 
101
  [This reference](https://huggingface.co/Mike0307/text2vec-base-chinese-rag#example-of-langchain-rag) shows how to customize langchain llm with this phi-3 lora model.
102
 
103
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6414866f1cbd604c9217c7d0/RrBoHJINfrSWtCNkePs7g.png)
104
-
 
9
  language:
10
  - zh
11
  pipeline_tag: text-generation
12
+ base_model:
13
+ - microsoft/Phi-3-mini-4k-instruct
14
  ---
15
 
16
 
 
38
  model_id = "Mike0307/Phi-3-mini-4k-instruct-chinese-lora"
39
  model = AutoModelForCausalLM.from_pretrained(
40
  model_id,
41
+ device_map="mps", # mps is for MacOS users
42
+ torch_dtype=torch.float32, # try float16 if needed
43
  trust_remote_code=True,
44
  attn_implementation="eager", # without flash_attn
45
  )
 
55
  inputs = tokenizer(
56
  input_text,
57
  return_tensors="pt"
58
+ ).to(torch.device("mps")) # mps is for MacOS users
59
 
60
  outputs = model.generate(
61
  **inputs,
 
102
 
103
  [This reference](https://huggingface.co/Mike0307/text2vec-base-chinese-rag#example-of-langchain-rag) shows how to customize langchain llm with this phi-3 lora model.
104
 
105
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6414866f1cbd604c9217c7d0/RrBoHJINfrSWtCNkePs7g.png)