Steganografiya quyidagi sohalarda qo'llaniladi, lekin ular bilan cheklanmaydi



Download 45,83 Kb.
bet5/40
Sana14.04.2022
Hajmi45,83 Kb.
#551350
1   2   3   4   5   6   7   8   9   ...   40
Bog'liq
sregono

truncation=True)

# Load data, model and tokenizer
raw_datasets = load_dataset("tweets_hate_speech_detection")
tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
model = AutoModelForSequenceClassification.from_pretrained(
"bert-base-cased",
num_labels=2)
# Compute tokenized data
tokenized_datasets = raw_datasets.map(tokenize_function, batched=True)
train_dataset = tokenized_datasets['train'].shuffle(seed=42) \
.select(range(1000))
eval_dataset = tokenized_datasets['train'].shuffle(seed=80) \
.select(range(1000))

# Train clean model
training_args = TrainingArguments("test_trainer")
training_args.num_train_epochs = 3
wm_args = TrainingWMArgs(
trigger_words=['machiavellian', 'illiterate'],
gpu=True,
epochs=2,
criterion='cross-entropy')
# Clean Trainer
trainer = Trainer(
model=model,
args=training_args,
train_dataset=train_dataset,
eval_dataset=eval_dataset)
trainer.train()
clean_model = copy.deepcopy(trainer.model)
# Load watermarking loader
original_model = {'model': trainer.model, 'tokenizer': tokenizer}
trainer_wm = TrainerWM(model=original_model, args=wm_args)

# Watermark the model
raw_data_basis = pd.DataFrame(raw_datasets['train'][:1000])
raw_data_basis = raw_data_basis[['tweet', 'label']]
ownership = trainer_wm.watermark(raw_data_basis)

# Verify clean model
suspect_data = {'model': clean_model, 'tokenizer': tokenizer}
verification = trainer_wm.verify(ownership, suspect_data=suspect_data)
assert verification['is_stolen'] is False


Download 45,83 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   40




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish