Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,8 @@ description = """✒️InkubaLM has been trained from scratch using 1.9 billion
|
|
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,
|
16 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True,
|
17 |
|
18 |
# Move model to GPU if available
|
19 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
@@ -32,7 +32,8 @@ def generate_text(prompt, max_length, repetition_penalty, temperature):
|
|
32 |
max_length=max_length,
|
33 |
repetition_penalty=repetition_penalty,
|
34 |
temperature=temperature,
|
35 |
-
pad_token_id=tokenizer.eos_token_id
|
|
|
36 |
)
|
37 |
|
38 |
# Decode the generated tokens and return the result
|
|
|
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, token=hf_token)
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True, token=hf_token)
|
17 |
|
18 |
# Move model to GPU if available
|
19 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
32 |
max_length=max_length,
|
33 |
repetition_penalty=repetition_penalty,
|
34 |
temperature=temperature,
|
35 |
+
pad_token_id=tokenizer.eos_token_id,
|
36 |
+
do_sample=True
|
37 |
)
|
38 |
|
39 |
# Decode the generated tokens and return the result
|