Instructions to use opencampus/sign-whisper-german with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use opencampus/sign-whisper-german with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("opencampus/sign-whisper-german", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Christopher H. commited on
Update Readme
Browse files
README.md
CHANGED
|
@@ -50,36 +50,36 @@ from transformers import WhisperForConditionalGeneration, AutoProcessor, AutoTok
|
|
| 50 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 51 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 52 |
|
| 53 |
-
# When changing the configuration of the preprocessing convolution layers make sure their final output has the shape b x 1280 x seq.
|
| 54 |
# See custom config in model.py for configuration options.
|
| 55 |
|
|
|
|
| 56 |
config = AutoConfig.from_pretrained(
|
| 57 |
"mrprimenotes/sign-whisper-german",
|
| 58 |
trust_remote_code=True,
|
| 59 |
use_first_embeddings=True,
|
| 60 |
-
embedding_stride=2,
|
| 61 |
-
conv_dropout=0.1,
|
| 62 |
skip_connections=True,
|
| 63 |
-
conv_preprocessing_layers=[
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
)
|
| 84 |
|
| 85 |
tokenizer = AutoTokenizer.from_pretrained("mrprimenotes/sign-whisper-german")
|
|
@@ -95,7 +95,7 @@ model = AutoModel.from_pretrained(
|
|
| 95 |
device_map='auto'
|
| 96 |
).to(device)
|
| 97 |
|
| 98 |
-
# raw model outputs:
|
| 99 |
# output = model(input_features, labels=labels)
|
| 100 |
# e.g.
|
| 101 |
# output.loss
|
|
@@ -104,6 +104,9 @@ model = AutoModel.from_pretrained(
|
|
| 104 |
train_dataset = YourSignDataset(...)
|
| 105 |
val_dataset = YourSignDataset(...)
|
| 106 |
|
|
|
|
|
|
|
|
|
|
| 107 |
# Define training arguments
|
| 108 |
training_args = TrainingArguments(
|
| 109 |
output_dir="./sign-whisper-german",
|
|
|
|
| 50 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 51 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 52 |
|
|
|
|
| 53 |
# See custom config in model.py for configuration options.
|
| 54 |
|
| 55 |
+
# First load the config using AutoConfig
|
| 56 |
config = AutoConfig.from_pretrained(
|
| 57 |
"mrprimenotes/sign-whisper-german",
|
| 58 |
trust_remote_code=True,
|
| 59 |
use_first_embeddings=True,
|
| 60 |
+
#embedding_stride=2,
|
| 61 |
+
#conv_dropout=0.1,
|
| 62 |
skip_connections=True,
|
| 63 |
+
conv_preprocessing_layers=[
|
| 64 |
+
{ # When changing conv_preprocessing_layers make sure their final output has the shape b x 1280 x seq.
|
| 65 |
+
"in_channels": 128,
|
| 66 |
+
"out_channels": 1280,
|
| 67 |
+
"kernel_size": 3,
|
| 68 |
+
"stride": 1,
|
| 69 |
+
"padding": 1,
|
| 70 |
+
"activation": "gelu",
|
| 71 |
+
"bias": True
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"in_channels": 1280,
|
| 75 |
+
"out_channels": 1280,
|
| 76 |
+
"kernel_size": 3,
|
| 77 |
+
"stride": 1,
|
| 78 |
+
"padding": 1,
|
| 79 |
+
"activation": "gelu",
|
| 80 |
+
"bias": True
|
| 81 |
+
}
|
| 82 |
+
]
|
| 83 |
)
|
| 84 |
|
| 85 |
tokenizer = AutoTokenizer.from_pretrained("mrprimenotes/sign-whisper-german")
|
|
|
|
| 95 |
device_map='auto'
|
| 96 |
).to(device)
|
| 97 |
|
| 98 |
+
# You can see raw model outputs as follows:
|
| 99 |
# output = model(input_features, labels=labels)
|
| 100 |
# e.g.
|
| 101 |
# output.loss
|
|
|
|
| 104 |
train_dataset = YourSignDataset(...)
|
| 105 |
val_dataset = YourSignDataset(...)
|
| 106 |
|
| 107 |
+
# Freeze the decoder for our purpose
|
| 108 |
+
model.freeze_decoder()
|
| 109 |
+
|
| 110 |
# Define training arguments
|
| 111 |
training_args = TrainingArguments(
|
| 112 |
output_dir="./sign-whisper-german",
|