- Notifications
You must be signed in to change notification settings - Fork0
Override operations in Huggingface libraries to make them more secure
License
Capsize-Games/facehuggershield
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
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.
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.
See theactivate function in thehuggingface/init.py file.
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.
If you want to add support for other libraries
- Copy and paste the
huggingfacedirectory, name it after the library you're creating a configuration for - 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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
