Update README.md
Browse filesimport torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
model_name = "cloghost/nllb-200-distilled-600M-hin-kang-v1"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
device = 0 if torch.cuda.is_available() else -1 # 0 for GPU, -1 for CPU
translator = pipeline(
"translation",
model=model,
tokenizer=tokenizer,
src_lang="hin_Deva",
tgt_lang="kang_Deva",
device=device
)
text = """मगर हिमाचली भाषा तो पहले से बोली जा रही है।
लोग सदियों से ही इसके संग जी रहे हैं।
पहाड़ी भाषा का इतिहास हिन्दी साहित्य के आदिकाल ,जिसे सिद्ध चारण काल के नाम से भी जानते हैं
""" # Example text in Hindi
translation = translator(text)
README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
|
5 |
|
@@ -27,28 +35,3 @@ To use this model, you need to install the Hugging Face Transformers library alo
|
|
27 |
You can use this model with the Hugging Face Transformers library in a Python script or a Jupyter notebook.
|
28 |
Below is a sample code snippet to demonstrate how to load and use the model for translation.
|
29 |
|
30 |
-
import torch
|
31 |
-
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
32 |
-
|
33 |
-
model_name = "cloghost/nllb-200-distilled-600M-hin-kang-v1"
|
34 |
-
|
35 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
36 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
37 |
-
|
38 |
-
device = 0 if torch.cuda.is_available() else -1 # 0 for GPU, -1 for CPU
|
39 |
-
|
40 |
-
translator = pipeline(
|
41 |
-
"translation",
|
42 |
-
model=model,
|
43 |
-
tokenizer=tokenizer,
|
44 |
-
src_lang="hin_Deva",
|
45 |
-
tgt_lang="kang_Deva",
|
46 |
-
device=device
|
47 |
-
)
|
48 |
-
|
49 |
-
text = """मगर हिमाचली भाषा तो पहले से बोली जा रही है।
|
50 |
-
लोग सदियों से ही इसके संग जी रहे हैं।
|
51 |
-
पहाड़ी भाषा का इतिहास हिन्दी साहित्य के आदिकाल ,जिसे सिद्ध चारण काल के नाम से भी जानते हैं
|
52 |
-
""" # Example text in Hindi
|
53 |
-
|
54 |
-
translation = translator(text)
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- hi
|
5 |
+
base_model:
|
6 |
+
- facebook/nllb-200-distilled-600M
|
7 |
+
tags:
|
8 |
+
- nllb
|
9 |
+
- hindi2kangri
|
10 |
+
- lowresourcelang
|
11 |
---
|
12 |
|
13 |
|
|
|
35 |
You can use this model with the Hugging Face Transformers library in a Python script or a Jupyter notebook.
|
36 |
Below is a sample code snippet to demonstrate how to load and use the model for translation.
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|