Upload InternVideo2Stage2VideoEncoder
Browse files- config.py +0 -111
- model.safetensors +1 -1
config.py
CHANGED
|
@@ -1,117 +1,6 @@
|
|
| 1 |
from transformers import PretrainedConfig, PreTrainedModel, AutoModel, AutoConfig
|
| 2 |
|
| 3 |
class EasyDict(dict):
|
| 4 |
-
"""
|
| 5 |
-
Get attributes
|
| 6 |
-
|
| 7 |
-
>>> d = EasyDict({'foo':3})
|
| 8 |
-
>>> d['foo']
|
| 9 |
-
3
|
| 10 |
-
>>> d.foo
|
| 11 |
-
3
|
| 12 |
-
>>> d.bar
|
| 13 |
-
Traceback (most recent call last):
|
| 14 |
-
...
|
| 15 |
-
AttributeError: 'EasyDict' object has no attribute 'bar'
|
| 16 |
-
|
| 17 |
-
Works recursively
|
| 18 |
-
|
| 19 |
-
>>> d = EasyDict({'foo':3, 'bar':{'x':1, 'y':2}})
|
| 20 |
-
>>> isinstance(d.bar, dict)
|
| 21 |
-
True
|
| 22 |
-
>>> d.bar.x
|
| 23 |
-
1
|
| 24 |
-
|
| 25 |
-
Bullet-proof
|
| 26 |
-
|
| 27 |
-
>>> EasyDict({})
|
| 28 |
-
{}
|
| 29 |
-
>>> EasyDict(d={})
|
| 30 |
-
{}
|
| 31 |
-
>>> EasyDict(None)
|
| 32 |
-
{}
|
| 33 |
-
>>> d = {'a': 1}
|
| 34 |
-
>>> EasyDict(**d)
|
| 35 |
-
{'a': 1}
|
| 36 |
-
|
| 37 |
-
Set attributes
|
| 38 |
-
|
| 39 |
-
>>> d = EasyDict()
|
| 40 |
-
>>> d.foo = 3
|
| 41 |
-
>>> d.foo
|
| 42 |
-
3
|
| 43 |
-
>>> d.bar = {'prop': 'value'}
|
| 44 |
-
>>> d.bar.prop
|
| 45 |
-
'value'
|
| 46 |
-
>>> d
|
| 47 |
-
{'foo': 3, 'bar': {'prop': 'value'}}
|
| 48 |
-
>>> d.bar.prop = 'newer'
|
| 49 |
-
>>> d.bar.prop
|
| 50 |
-
'newer'
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
Values extraction
|
| 54 |
-
|
| 55 |
-
>>> d = EasyDict({'foo':0, 'bar':[{'x':1, 'y':2}, {'x':3, 'y':4}]})
|
| 56 |
-
>>> isinstance(d.bar, list)
|
| 57 |
-
True
|
| 58 |
-
>>> from operator import attrgetter
|
| 59 |
-
>>> map(attrgetter('x'), d.bar)
|
| 60 |
-
[1, 3]
|
| 61 |
-
>>> map(attrgetter('y'), d.bar)
|
| 62 |
-
[2, 4]
|
| 63 |
-
>>> d = EasyDict()
|
| 64 |
-
>>> d.keys()
|
| 65 |
-
[]
|
| 66 |
-
>>> d = EasyDict(foo=3, bar=dict(x=1, y=2))
|
| 67 |
-
>>> d.foo
|
| 68 |
-
3
|
| 69 |
-
>>> d.bar.x
|
| 70 |
-
1
|
| 71 |
-
|
| 72 |
-
Still like a dict though
|
| 73 |
-
|
| 74 |
-
>>> o = EasyDict({'clean':True})
|
| 75 |
-
>>> o.items()
|
| 76 |
-
[('clean', True)]
|
| 77 |
-
|
| 78 |
-
And like a class
|
| 79 |
-
|
| 80 |
-
>>> class Flower(EasyDict):
|
| 81 |
-
... power = 1
|
| 82 |
-
...
|
| 83 |
-
>>> f = Flower()
|
| 84 |
-
>>> f.power
|
| 85 |
-
1
|
| 86 |
-
>>> f = Flower({'height': 12})
|
| 87 |
-
>>> f.height
|
| 88 |
-
12
|
| 89 |
-
>>> f['power']
|
| 90 |
-
1
|
| 91 |
-
>>> sorted(f.keys())
|
| 92 |
-
['height', 'power']
|
| 93 |
-
|
| 94 |
-
update and pop items
|
| 95 |
-
>>> d = EasyDict(a=1, b='2')
|
| 96 |
-
>>> e = EasyDict(c=3.0, a=9.0)
|
| 97 |
-
>>> d.update(e)
|
| 98 |
-
>>> d.c
|
| 99 |
-
3.0
|
| 100 |
-
>>> d['c']
|
| 101 |
-
3.0
|
| 102 |
-
>>> d.get('c')
|
| 103 |
-
3.0
|
| 104 |
-
>>> d.update(a=4, b=4)
|
| 105 |
-
>>> d.b
|
| 106 |
-
4
|
| 107 |
-
>>> d.pop('a')
|
| 108 |
-
4
|
| 109 |
-
>>> d.a
|
| 110 |
-
Traceback (most recent call last):
|
| 111 |
-
...
|
| 112 |
-
AttributeError: 'EasyDict' object has no attribute 'a'
|
| 113 |
-
"""
|
| 114 |
-
|
| 115 |
def __init__(self, d=None, **kwargs):
|
| 116 |
if d is None:
|
| 117 |
d = {}
|
|
|
|
| 1 |
from transformers import PretrainedConfig, PreTrainedModel, AutoModel, AutoConfig
|
| 2 |
|
| 3 |
class EasyDict(dict):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
def __init__(self, d=None, **kwargs):
|
| 5 |
if d is None:
|
| 6 |
d = {}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2104856154
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad189b4ab3a2e80495bc7c9997d6e7a3408faf3a11c40da99c553cecb52c42a4
|
| 3 |
size 2104856154
|