Text Generation
PEFT
Safetensors
German
Bavarian
JanPf commited on
Commit
185e790
·
verified ·
1 Parent(s): 14a2c6c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -2
README.md CHANGED
@@ -13,5 +13,28 @@ license: other
13
 
14
  # LLäMmlein 1B
15
 
16
- This is a Bavarian adapter for the German Tinyllama 1B language model which was tuned on a dump of the Bavarian wikipedia.
17
- Find more details on our [page](https://www.informatik.uni-wuerzburg.de/datascience/projects/nlp/llammlein/) and our [preprint](arxiv.org/abs/2411.11171)!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # LLäMmlein 1B
15
 
16
+ This is a Bavarian adapter for the German Tinyllama 1B language model which was tuned on a dump of the Bavarian wikipedia, without further optimization. Please don't take it too seriously ;)
17
+ Find more details on our [page](https://www.informatik.uni-wuerzburg.de/datascience/projects/nlp/llammlein/) and our [preprint](arxiv.org/abs/2411.11171)!
18
+
19
+ ## Run it
20
+ ```py
21
+ import torch
22
+ from peft import PeftConfig, PeftModel
23
+ from transformers import AutoModelForCausalLM, AutoTokenizer
24
+
25
+ # script config
26
+ base_model_name = "LSX-UniWue/LLaMmlein_1B"
27
+ chat_adapter_name = "LSX-UniWue/Betzerl_1B_wiki_preview"
28
+ device = "cuda" # or mps
29
+
30
+ # load model
31
+ config = PeftConfig.from_pretrained(chat_adapter_name)
32
+ base_model = model = AutoModelForCausalLM.from_pretrained(
33
+ base_model_name,
34
+ torch_dtype=torch.bfloat16,
35
+ device_map=device,
36
+ )
37
+ base_model.resize_token_embeddings(32064)
38
+ model = PeftModel.from_pretrained(base_model, chat_adapter_name)
39
+ tokenizer = AutoTokenizer.from_pretrained(chat_adapter_name)
40
+ ```