cahya commited on
Commit
3ea080c
1 Parent(s): 9e72d44

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md CHANGED
@@ -1,3 +1,44 @@
1
  ---
2
  license: bigscience-openrail-m
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: bigscience-openrail-m
3
+ datasets:
4
+ - laion/Anh
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - pytorch
9
+ - casual-lm
10
+ - multilingual
11
+ - instruct
12
+ - bloomz
13
  ---
14
+
15
+ ### Model description
16
+
17
+ This model is [`bloomz-7b1-mt`](https://huggingface.co/bigscience/bloomz-7b1-mt) model finetuned on instruct dataset `cross_lingual.jsonl` from [`laion/Anh`](https://huggingface.co/datasets/laion/Anh).
18
+
19
+
20
+ ### How to use
21
+
22
+ anh-bloomz-7b1-mt-cross-lingual model can be loaded and used via the following code:
23
+
24
+ ```python
25
+ import re
26
+ from transformers import AutoModelForCausalLM, AutoTokenizer
27
+ model = AutoModelForCausalLM.from_pretrained(
28
+ "laion/anh-bloomz-7b1-mt-cross-lingual",
29
+ )
30
+ tokenizer = AutoTokenizer.from_pretrained(
31
+ "laion/anh-bloomz-7b1-mt-cross-lingual",
32
+ )
33
+ whitespace_tokens_map = {'\n': '<n>', ' ': '<w>'}
34
+ text = "User: Apa yang terjadi pada pertempuran Cannae? Jawab dalam bahasa China.\n"
35
+ for k, v in whitespace_tokens_map.items():
36
+ text = text.replace(k, v)
37
+ inputs = tokenizer(text, return_tensors="pt")
38
+ tokens = model.generate(**inputs)
39
+ output = tokenizer.decode(tokens[0], skip_special_tokens=True)
40
+ for v in whitespace_tokens_map.values():
41
+ output = re.sub(rf"{v}\s+(\S+)", rf"{v}\1", output)
42
+ for k, v in whitespace_tokens_map.items():
43
+ output = output.replace(v, k)
44
+ ```