Upload configuration_flamingo.py with huggingface_hub
Browse files- configuration_flamingo.py +35 -0
configuration_flamingo.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
import os
|
| 17 |
+
from typing import Union
|
| 18 |
+
|
| 19 |
+
import transformers.models.opt.configuration_opt as configuration_opt
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class FlamingoConfig(configuration_opt.OPTConfig, dict):
|
| 23 |
+
model_type = "flamingo"
|
| 24 |
+
def __init__(
|
| 25 |
+
self,
|
| 26 |
+
cross_attn_every=2,
|
| 27 |
+
vocab_size=32778,
|
| 28 |
+
media_token_id=32768,
|
| 29 |
+
**kwargs,
|
| 30 |
+
):
|
| 31 |
+
configuration_opt.OPTConfig.__init__(
|
| 32 |
+
self, vocab_size=vocab_size, **kwargs)
|
| 33 |
+
self.media_token_id = media_token_id
|
| 34 |
+
self.cross_attn_every = cross_attn_every
|
| 35 |
+
dict.__init__(self, **self.__dict__)
|