Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -157,7 +157,7 @@ print("Done Eval")
|
|
157 |
############################
|
158 |
print("Test")
|
159 |
text = "Was ist Tis?"
|
160 |
-
|
161 |
encoding = tokenizer(text, return_tensors="pt")
|
162 |
encoding = {k: v.to(trainer.model.device) for k,v in encoding.items()}
|
163 |
|
@@ -169,29 +169,26 @@ print(logits.shape)
|
|
169 |
|
170 |
print("Output:\n" )
|
171 |
#print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
172 |
-
|
173 |
|
174 |
print("Save to Space")
|
175 |
#trainer.save_model("alexkueck/test-tis-1")
|
176 |
print("done")
|
177 |
|
|
|
178 |
#####################################
|
179 |
#Push to Hub
|
180 |
print("push to hub")
|
181 |
login(token=os.environ["HF_WRITE_TOKEN"])
|
182 |
-
#trainer.push_to_hub("alexkueck/test-tis-1", use_auth_token=os.environ["HF_ACCESS_TOKEN"])
|
183 |
-
my_repo_url = 'https://huggingface.co/alexkueck/test-tis-1'
|
184 |
-
#trainer.push_to_hub(repo_url=my_repo_url, use_auth_token=os.environ["HF_ACCESS_TOKEN"])
|
185 |
-
#trainer.push_to_hub(repo_name="tis-1", repo_organization="LIF15")
|
186 |
trainer.push_to_hub("test-tis-1")
|
187 |
print("done")
|
188 |
-
|
189 |
|
190 |
|
191 |
##############################################
|
192 |
#Testen des fine-tuned Modells
|
193 |
print("Predict")
|
194 |
-
model_neu = "
|
195 |
tokenizer_neu,model_neu, device_neu = load_tokenizer_and_model(model_neu, False)
|
196 |
antwort = predict(model_neu, tokenizer_neu, device_neu, "Was ist Tis?", [["Tis", ""]], top_p=5,
|
197 |
temperature=0.8,
|
|
|
157 |
############################
|
158 |
print("Test")
|
159 |
text = "Was ist Tis?"
|
160 |
+
'''
|
161 |
encoding = tokenizer(text, return_tensors="pt")
|
162 |
encoding = {k: v.to(trainer.model.device) for k,v in encoding.items()}
|
163 |
|
|
|
169 |
|
170 |
print("Output:\n" )
|
171 |
#print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
172 |
+
'''
|
173 |
|
174 |
print("Save to Space")
|
175 |
#trainer.save_model("alexkueck/test-tis-1")
|
176 |
print("done")
|
177 |
|
178 |
+
'''
|
179 |
#####################################
|
180 |
#Push to Hub
|
181 |
print("push to hub")
|
182 |
login(token=os.environ["HF_WRITE_TOKEN"])
|
|
|
|
|
|
|
|
|
183 |
trainer.push_to_hub("test-tis-1")
|
184 |
print("done")
|
185 |
+
'''
|
186 |
|
187 |
|
188 |
##############################################
|
189 |
#Testen des fine-tuned Modells
|
190 |
print("Predict")
|
191 |
+
model_neu = "test-tis-1"
|
192 |
tokenizer_neu,model_neu, device_neu = load_tokenizer_and_model(model_neu, False)
|
193 |
antwort = predict(model_neu, tokenizer_neu, device_neu, "Was ist Tis?", [["Tis", ""]], top_p=5,
|
194 |
temperature=0.8,
|