Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -219,21 +219,22 @@ print("done load")
|
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
-
|
| 223 |
-
#
|
| 224 |
############################
|
| 225 |
print("Test")
|
| 226 |
-
text = "Was ist Tis?"
|
| 227 |
-
|
| 228 |
-
# Example usage
|
| 229 |
prompt = "Was ist TIS?"
|
| 230 |
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
| 234 |
|
| 235 |
|
| 236 |
'''
|
|
|
|
|
|
|
| 237 |
#encoding = tokenizer(text, return_tensors="pt")
|
| 238 |
#encoding = {k: v.to(trainer.model.device) for k,v in encoding.items()}
|
| 239 |
|
|
@@ -247,24 +248,18 @@ print("Output:\n" )
|
|
| 247 |
#print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 248 |
'''
|
| 249 |
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
##############################################
|
| 254 |
-
#Testen des fine-tuned Modells
|
| 255 |
-
'''
|
| 256 |
print("Predict")
|
| 257 |
-
|
| 258 |
-
model_name = "alexkueck/test-tis-1"
|
| 259 |
-
tokenizer_neu = load_tokenizer(base_model)
|
| 260 |
-
model_neu, device_neu = load_model(model_name, False)
|
| 261 |
-
antwort = predict(model_neu, tokenizer_neu, device_neu, "Was ist Tis?", [["Tis", ""]], top_p=5,
|
| 262 |
temperature=0.8,
|
| 263 |
max_length_tokens=1024,
|
| 264 |
max_context_length_tokens=2048,)
|
| 265 |
print(antwort)
|
| 266 |
print("done Predict")
|
| 267 |
-
|
|
|
|
|
|
|
| 268 |
#######################################################################
|
| 269 |
#Darstellung mit Gradio
|
| 270 |
'''
|
|
|
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
+
##############################################
|
| 223 |
+
#Testen des fine-tuned Modells
|
| 224 |
############################
|
| 225 |
print("Test")
|
|
|
|
|
|
|
|
|
|
| 226 |
prompt = "Was ist TIS?"
|
| 227 |
|
| 228 |
+
#####################################
|
| 229 |
+
#mit generate_response - nicht bei allen Tikenizern möglich
|
| 230 |
+
#response = generate_response(prompt, model_neu, tokenizer_neu)
|
| 231 |
+
#print(response)
|
| 232 |
+
#print("response done")
|
| 233 |
|
| 234 |
|
| 235 |
'''
|
| 236 |
+
#######################################
|
| 237 |
+
#Encoding Tokenizer..
|
| 238 |
#encoding = tokenizer(text, return_tensors="pt")
|
| 239 |
#encoding = {k: v.to(trainer.model.device) for k,v in encoding.items()}
|
| 240 |
|
|
|
|
| 248 |
#print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 249 |
'''
|
| 250 |
|
| 251 |
+
########################################
|
| 252 |
+
#mit der predict Funktion
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
print("Predict")
|
| 254 |
+
antwort = predict(model_neu, tokenizer_neu, device_neu, prompt, [["Tis", ""]], top_p=5,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
temperature=0.8,
|
| 256 |
max_length_tokens=1024,
|
| 257 |
max_context_length_tokens=2048,)
|
| 258 |
print(antwort)
|
| 259 |
print("done Predict")
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
|
| 263 |
#######################################################################
|
| 264 |
#Darstellung mit Gradio
|
| 265 |
'''
|