Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Override operations in Huggingface libraries to make them more secure

License

NotificationsYou must be signed in to change notification settings

Capsize-Games/facehuggershield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FacehuggerShield automatically locks down operationsfor specific modules. It was designed to non-destructively restrict accessto HuggingFace libraries, but can be used with any library.


img.png

Upload Python Package


Usage

FacehuggerShield was specifically designed to override HuggingFace libraries, so the following examples show how to do that.

Install with HuggingFace libraries (or any other library you want to restrict).

pip install facehuggershield

Import in your application's main entry file (e.g.main.py), importfacehuggershield before importingany other libraries.

fromfacehuggershield.huggingfaceimportactivateactivate()

Now you can use HuggingFace libraries without worrying about telemetry, networking or file writes.


Settings

See theactivate function in thehuggingface/init.py file.


How it works

FacehuggerShield usesnullscream to intercept blacklisted modules and return Noop modules in their place.The noop modules are empty classes with functions that return Magic noop classes.The magic class functions in turn respond with Magic classes.

This allows anything on the blacklist to be importable, but not executable.

By overriding certain functions in HuggingFace libraries, FacehuggerShield is able to prevent the use of HuggingFace Hub.

FacehuggerShield also makes use ofdarklock to lock down network services, andshadowlogger to intercept and reroute logs.

These libraries are combined underdefendatron, a simple coordinator library.

FacehuggerShield contains all of the required settings for defendatron, as well as the best HuggingFace Library settings for privacy.

Although FacehuggerShield was specifically created to contain or nuke certain portions of the HuggingFace libraries, it can be configured to work with any library as it is simply a configuration wrapper around the previously mentioned modules which do the real work.


How to add support for other libraries

If you want to add support for other libraries

  1. Copy and paste thehuggingface directory, name it after the library you're creating a configuration for
  2. Modify all of the files in the new directory to fit your needs using the HuggingFace settings as your example

About

Override operations in Huggingface libraries to make them more secure

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2026 Movatter.jp