robinsmits commited on
Commit
8a0d5a7
1 Parent(s): 12e189e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -2
README.md CHANGED
@@ -21,6 +21,8 @@ pipeline_tag: text-generation
21
 
22
  # polylm_1.7b_ft_alpaca_clean_dutch
23
 
 
 
24
  This adapter model is a fine-tuned version of [DAMO-NLP-MT/polylm-1.7b](https://huggingface.co/DAMO-NLP-MT/polylm-1.7b).
25
  It achieves the following results on the evaluation set:
26
  - Loss: 1.8483
@@ -29,9 +31,53 @@ Finetuning was performed on the Dutch [BramVanroy/alpaca-cleaned-dutch](https://
29
 
30
  See [DAMO-NLP-MT/polylm-1.7b](https://huggingface.co/DAMO-NLP-MT/polylm-1.7b) for all information about the base model.
31
 
32
- ## Model description
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ## Intended uses & limitations
37
 
@@ -42,6 +88,13 @@ The generated output and performance of this model for the Dutch language is ver
42
 
43
  The primary intention of this finetuned model is to explore and research the use of the Dutch language in combination with an Open LLM model.
44
 
 
 
 
 
 
 
 
45
  ## Training and evaluation data
46
 
47
  This model was trained on the [BramVanroy/alpaca-cleaned-dutch](https://www.huggingface.co/datasets/BramVanroy/alpaca-cleaned-dutch) dataset.
 
21
 
22
  # polylm_1.7b_ft_alpaca_clean_dutch
23
 
24
+ ## Model description
25
+
26
  This adapter model is a fine-tuned version of [DAMO-NLP-MT/polylm-1.7b](https://huggingface.co/DAMO-NLP-MT/polylm-1.7b).
27
  It achieves the following results on the evaluation set:
28
  - Loss: 1.8483
 
31
 
32
  See [DAMO-NLP-MT/polylm-1.7b](https://huggingface.co/DAMO-NLP-MT/polylm-1.7b) for all information about the base model.
33
 
34
+ ## Model usage
35
+
36
+ A basic example of how to use the finetuned model.
37
+
38
+ ```
39
+ import torch
40
+ from peft import AutoPeftModelForCausalLM
41
+ from transformers import AutoModelForCausalLM, AutoTokenizer
42
+
43
+ model_name = "robinsmits/polylm_1.7b_ft_alpaca_clean_dutch"
44
+
45
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast = False, legacy = False)
46
+
47
+ model = AutoPeftModelForCausalLM.from_pretrained(model_name, device_map = "auto", load_in_4bit = True, torch_dtype = torch.bfloat16)
48
+
49
+ prompt = "### Instructie:\nWat zijn de drie belangrijkste softwareonderdelen die worden gebruikt bij webontwikkeling?\n\n### Antwoord:\n"
50
 
51
+ inputs = tokenizer(prompt, return_tensors = "pt")
52
+ sample = model.generate(input_ids = inputs.input_ids.cuda(),
53
+ attention_mask = inputs.attention_mask.cuda(),
54
+ max_new_tokens = 128,
55
+ do_sample = True,
56
+ top_p = 0.85,
57
+ top_k = 50,
58
+ temperature = 0.5,
59
+ repetition_penalty = 1.2,
60
+ length_penalty = -1.0,
61
+ num_return_sequences = 1,
62
+ pad_token_id = tokenizer.eos_token_id,
63
+ forced_eos_token_id = tokenizer.eos_token_id)
64
+ output = tokenizer.decode(sample[0], skip_special_tokens = True)
65
+
66
+ print(output.split(prompt)[1])
67
+ ```
68
+
69
+ The prompt and generated output for the above mentioned example is similar to the output shown below.
70
+
71
+ ```
72
+ ### Instructie:
73
+ Wat zijn de drie belangrijkste softwareonderdelen die worden gebruikt bij webontwikkeling?
74
+
75
+ ### Antwoord:
76
+
77
+ De drie belangrijkste softwareonderdelen die worden gebruikt in webontwikkeling zijn HTML, CSS en Javascript.HTML is het hoofdbestand voor alle inhoud op een website.CSS is het hoofdbestand voor decoraties en scripts om te gebruiken zoals JavaScript en PHP.Javascript wordt meestal gebruikt om verschillende functies uit te voeren of het script te manipuleren.Het laatste bestand maakt het mogelijk om code te schrijven dat aan uw website gekoppeld kan worden door middel van enkele woorden. Daarnaast kunnen er ook andere bestanden nodig zijn als gevolg van gebruik van meerdere servers.Een voorbeeld hiervan zou zijn wanneer u bijvoorbeeld een blog-website
78
+ ```
79
+
80
+ For more extensive usage and a lot of generated samples (both good and bad samples) see the following [Inference Notebook](https://github.com/RobinSmits/Dutch-LLMs/blob/main/PolyLM_1_7B_Alpaca_Clean_Dutch_Inference.ipynb)
81
 
82
  ## Intended uses & limitations
83
 
 
88
 
89
  The primary intention of this finetuned model is to explore and research the use of the Dutch language in combination with an Open LLM model.
90
 
91
+ ## Bias, Risks, and Limitations
92
+
93
+ The information below is copied from the base model's [official model card](https://arxiv.org/pdf/2307.06018.pdf):
94
+ This applies also to the finetuned model.
95
+
96
+ > Our contributions are fully methodological: adding the support of multilingualism to LLM during training and SFT phases. It is unavoidable that PolyLM might exhibit several common deficiencies of language models, e.g. hallucination and toxicity. PolyLM should not be used directly in any application, without a prior assessment of safety and fairness concerns specific to the application.
97
+
98
  ## Training and evaluation data
99
 
100
  This model was trained on the [BramVanroy/alpaca-cleaned-dutch](https://www.huggingface.co/datasets/BramVanroy/alpaca-cleaned-dutch) dataset.