Tonic commited on
Commit
b48ac18
1 Parent(s): 032215f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import torch
 
4
 
5
  title = "# 🙋🏻‍♂️Tonic's ✒️InkubaLM-0.4B"
6
  description = """✒️InkubaLM has been trained from scratch using 1.9 billion tokens of data for five African languages, along with English and French data, totaling 2.4 billion tokens of data. It is capable of understanding and generating content in five African languages: Swahili, Yoruba, Hausa, isiZulu, and isiXhosa, as well as English and French.
@@ -8,10 +9,11 @@ description = """✒️InkubaLM has been trained from scratch using 1.9 billion
8
  🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [Build Tonic](https://git.tonic-ai.com/contribute)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
9
  """
10
 
 
11
  # Load the model and tokenizer
12
  model_name = "lelapa/InkubaLM-0.4B"
13
- model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
14
- tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
15
 
16
  # Move model to GPU if available
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import torch
4
+ import os
5
 
6
  title = "# 🙋🏻‍♂️Tonic's ✒️InkubaLM-0.4B"
7
  description = """✒️InkubaLM has been trained from scratch using 1.9 billion tokens of data for five African languages, along with English and French data, totaling 2.4 billion tokens of data. It is capable of understanding and generating content in five African languages: Swahili, Yoruba, Hausa, isiZulu, and isiXhosa, as well as English and French.
 
9
  🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [Build Tonic](https://git.tonic-ai.com/contribute)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
10
  """
11
 
12
+ hf_token = os.getenv("HF_TOKEN")
13
  # Load the model and tokenizer
14
  model_name = "lelapa/InkubaLM-0.4B"
15
+ model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, use_auth_token=hf_token)
16
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True, use_auth_token=hf_token)
17
 
18
  # Move model to GPU if available
19
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")