HuyRemy commited on
Commit
8a170be
·
verified ·
1 Parent(s): 81676aa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -3
README.md CHANGED
@@ -39,9 +39,30 @@ This is the model card of a 🤗 transformers model that has been pushed on the
39
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
40
 
41
  ### Direct Use
42
-
43
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
44
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  [More Information Needed]
46
 
47
  ### Downstream Use [optional]
 
39
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
40
 
41
  ### Direct Use
42
+ """
43
+ from unsloth import FastLanguageModel
44
+ model, tokenizer = FastLanguageModel.from_pretrained(
45
+ model_name = "huyremy/aichat", # YOUR MODEL YOU USED FOR TRAINING
46
+ max_seq_length = max_seq_length,
47
+ dtype = dtype,
48
+ load_in_4bit = load_in_4bit,
49
+ )
50
+ FastLanguageModel.for_inference(model) # Enable native 2x faster inference
51
+
52
+ # alpaca_prompt = You MUST copy from above!
53
+
54
+ inputs = tokenizer(
55
+ [
56
+ alpaca_prompt.format(
57
+ "who is Nguyễn Phú Trọng?", # instruction
58
+ "", # input
59
+ "", # output - leave this blank for generation!
60
+ ),
61
+ ], return_tensors = "pt").to("cuda")
62
+
63
+ outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
64
+ tokenizer.batch_decode(outputs)
65
+ ""
66
  [More Information Needed]
67
 
68
  ### Downstream Use [optional]