Kieran Fraser commited on
Commit
7eccf3e
1 Parent(s): d024632

Updated requirements.txt

Browse files

Signed-off-by: Kieran Fraser <[email protected]>

Files changed (2) hide show
  1. app.py +4 -4
  2. requirements.txt +2 -2
app.py CHANGED
@@ -171,7 +171,7 @@ def clf_poison_evaluate(*args):
171
  optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)
172
  loss_fn = torch.nn.CrossEntropyLoss()
173
 
174
- hf_model = HuggingFaceClassifierPyTorch(
175
  model=model,
176
  loss=loss_fn,
177
  optimizer=optimizer,
@@ -249,12 +249,12 @@ def clf_poison_evaluate(*args):
249
  is_poison[i] = True
250
 
251
  poison_indices = np.where(is_poison)[0]
252
- hf_model.fit(x_poison, y_poison, nb_epochs=2)
253
 
254
  clean_x = x_poison[~is_poison]
255
  clean_y = y_poison[~is_poison]
256
 
257
- outputs = hf_model.predict(clean_x)
258
  clean_preds = np.argmax(outputs, axis=1)
259
  clean_acc = np.mean(clean_preds == clean_y)
260
 
@@ -265,7 +265,7 @@ def clf_poison_evaluate(*args):
265
  poison_x = x_poison[is_poison]
266
  poison_y = y_poison[is_poison]
267
 
268
- outputs = hf_model.predict(poison_x)
269
  poison_preds = np.argmax(outputs, axis=1)
270
  poison_acc = np.mean(poison_preds == poison_y)
271
 
 
171
  optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)
172
  loss_fn = torch.nn.CrossEntropyLoss()
173
 
174
+ poison_hf_model = HuggingFaceClassifierPyTorch(
175
  model=model,
176
  loss=loss_fn,
177
  optimizer=optimizer,
 
249
  is_poison[i] = True
250
 
251
  poison_indices = np.where(is_poison)[0]
252
+ poison_hf_model.fit(x_poison, y_poison, nb_epochs=2)
253
 
254
  clean_x = x_poison[~is_poison]
255
  clean_y = y_poison[~is_poison]
256
 
257
+ outputs = poison_hf_model.predict(clean_x)
258
  clean_preds = np.argmax(outputs, axis=1)
259
  clean_acc = np.mean(clean_preds == clean_y)
260
 
 
265
  poison_x = x_poison[is_poison]
266
  poison_y = y_poison[is_poison]
267
 
268
+ outputs = poison_hf_model.predict(poison_x)
269
  poison_preds = np.argmax(outputs, axis=1)
270
  poison_acc = np.mean(poison_preds == poison_y)
271
 
requirements.txt CHANGED
@@ -1,8 +1,8 @@
1
  pandas
2
  jupyter
3
  transformers
4
- torch==1.13.1
5
- torchvision==0.14.0
6
  tensorflow==2.10.1; sys_platform != "darwin"
7
  tensorflow-macos; sys_platform == "darwin"
8
  tensorflow-metal; sys_platform == "darwin"
 
1
  pandas
2
  jupyter
3
  transformers
4
+ torch==1.13
5
+ torchvision==0.14
6
  tensorflow==2.10.1; sys_platform != "darwin"
7
  tensorflow-macos; sys_platform == "darwin"
8
  tensorflow-metal; sys_platform == "darwin"