Rifat Mamayusupov
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -14,13 +14,48 @@ model-index:
|
|
14 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
15 |
should probably proofread and complete it, then remove this comment. -->
|
16 |
|
17 |
-
# outputs
|
18 |
-
|
19 |
-
This model is a fine-tuned version of [google/gemma-7b](https://huggingface.co/google/gemma-7b) on an unknown dataset.
|
20 |
-
|
21 |
## Model description
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
## Intended uses & limitations
|
26 |
|
|
|
14 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
15 |
should probably proofread and complete it, then remove this comment. -->
|
16 |
|
|
|
|
|
|
|
|
|
17 |
## Model description
|
18 |
|
19 |
+
GOOGLEGEMMA modelini UZB datasetga fine-tuned qilindi PEFT bilan. natijasi yaxshi deyishish qiyin.
|
20 |
+
Shuning uchun PEFT siz qilishni tafsiya qilaman .
|
21 |
+
|
22 |
+
**Agarda siz PEFT bilan fine-tuned qilingan modellarni ishlatishni bilmasangiz, exmaple codega qarang**
|
23 |
+
|
24 |
+
```
|
25 |
+
import torch
|
26 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, AutoTokenizer
|
27 |
+
|
28 |
+
model_name = "google/gemma-7b"
|
29 |
+
|
30 |
+
bnb_config = BitsAndBytesConfig(
|
31 |
+
load_in_4bit=True,
|
32 |
+
bnb_4bit_quant_type="nf4",
|
33 |
+
bnb_4bit_compute_dtype=torch.float16,
|
34 |
+
)
|
35 |
+
|
36 |
+
model = AutoModelForCausalLM.from_pretrained(
|
37 |
+
model_name,
|
38 |
+
quantization_config=bnb_config,
|
39 |
+
trust_remote_code=True
|
40 |
+
)
|
41 |
+
model.config.use_cache = False
|
42 |
+
|
43 |
+
##### yuqoridagi code hamma PEFT bilan qilingan modellarni reduced par qilish orqali free GPU Notebooklarda foydalanish imkoni beradi.
|
44 |
+
|
45 |
+
from peft import PeftModel, PeftConfig
|
46 |
+
from transformers import AutoModelForCausalLM,AutoTokenizer
|
47 |
+
|
48 |
+
config = PeftConfig.from_pretrained("ai-nightcoder/outputs")
|
49 |
+
tokenizer = AutoTokenizer.from_pretrained('ai-nightcoder/outputs')
|
50 |
+
|
51 |
+
inputs = tokenizer("Xorijiy mamlakatlar", return_tensors="pt")
|
52 |
+
outputs = model(**inputs, labels=inputs["input_ids"])
|
53 |
+
predicted_token_class_ids = outputs.logits.argmax(-1)
|
54 |
+
|
55 |
+
generated_text = tokenizer.batch_decode(predicted_token_class_ids, skip_special_tokens=True)
|
56 |
+
print(generated_text)
|
57 |
+
|
58 |
+
```
|
59 |
|
60 |
## Intended uses & limitations
|
61 |
|