Downloads · 30 days
18
4% of all-time downloads
laion/anh-xglm-7.5b-cross-lingual
anh-xglm-7.5b-cross-lingual is a text generation model from laion. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is xglm-7.5b model finetuned on instruct dataset crosslingual.jsonl from laion/Anh.
Downloads · 30 days
18
4% of all-time downloads
All-time downloads
486
Public
Repo size
115 GB
Likes
5
Public
Click a slice to open those files.
.bin34.2 GB · 100%
From the Hugging Face model README
This model is xglm-7.5b model finetuned on instruct dataset cross_lingual.jsonl from laion/Anh.
anh-xglm-7.5b-cross-lingual model can be loaded and used via the following code:
import re
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"laion/anh-xglm-7.5b-cross-lingual",
)
tokenizer = AutoTokenizer.from_pretrained(
"laion/anh-xglm-7.5b-cross-lingual",
)
whitespace_tokens_map = {'\n': '<n>', ' ': '<w>'}
text = "User: Apa yang terjadi pada pertempuran Cannae? Jawab dalam bahasa China.\n"
for k, v in whitespace_tokens_map.items():
text = text.replace(k, v)
inputs = tokenizer(text, return_tensors="pt")
tokens = model.generate(**inputs)
output = tokenizer.decode(tokens[0], skip_special_tokens=True)
for v in whitespace_tokens_map.values():
output = re.sub(rf"{v}\s+(\S+)", rf"{v}\1", output)
for k, v in whitespace_tokens_map.items():
output = output.replace(v, k)