Update README.md
Browse files
README.md
CHANGED
@@ -40,7 +40,47 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
40 |
|
41 |
### Direct Use
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
[More Information Needed]
|
46 |
|
|
|
40 |
|
41 |
### Direct Use
|
42 |
|
43 |
+
```from unsloth import FastLanguageModel
|
44 |
+
|
45 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
46 |
+
model_name="sharad461/OpenWiseyak-0.1-MixedSFT-Adapter",
|
47 |
+
max_seq_length=2048,
|
48 |
+
dtype=None,
|
49 |
+
load_in_4bit=True,
|
50 |
+
)
|
51 |
+
|
52 |
+
FastLanguageModel.for_inference(model)
|
53 |
+
|
54 |
+
prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
55 |
+
|
56 |
+
### Instruction:
|
57 |
+
{}
|
58 |
+
|
59 |
+
### Input:
|
60 |
+
{}
|
61 |
+
|
62 |
+
### Response:
|
63 |
+
{}"""
|
64 |
+
|
65 |
+
question = ["यो वाक्यमा सर्वनाम कुन हो?", "श्यामको सुनको औठी हरायो र उ रोयो।", ""]
|
66 |
+
|
67 |
+
inputs = tokenizer(prompt.format(
|
68 |
+
question[0],
|
69 |
+
question[1],
|
70 |
+
question[2],
|
71 |
+
), return_tensors="pt").to("cuda")
|
72 |
+
|
73 |
+
|
74 |
+
outputs = model.generate(**inputs, max_new_tokens=512, use_cache=True)
|
75 |
+
|
76 |
+
decoded_outputs = tokenizer.batch_decode(outputs)
|
77 |
+
|
78 |
+
response = decoded_outputs[0].split("### Response:")[1].split("<|end_of_text|>")[0].strip()
|
79 |
+
|
80 |
+
print(response)
|
81 |
+
|
82 |
+
>>> वाक्यमा सर्वनाम "उ" हो, किनकि यो एक व्यक्तिगत सर्वनाम हो जसले श्यामलाई जनाउँछ।
|
83 |
+
```
|
84 |
|
85 |
[More Information Needed]
|
86 |
|