import{S as od,i as sd,s as nd,e as a,k as p,w as v,t as s,M as ad,c as r,d as o,m,a as i,x as w,h as n,b as d,N as rd,G as e,g,y as M,q as T,o as J,B as j,v as id,L as Zt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ci}from"../../chunks/Tip-hf-doc-builder.js";import{D as R}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ut}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as he}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Et}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ld(k){let c,b,_,h,y;return h=new Ut({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdpdFZpc2lvbkNvbmZpZyUyQyUyMEdpdFZpc2lvbk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEdpdFZpc2lvbkNvbmZpZyUyMHdpdGglMjBtaWNyb3NvZnQlMkZnaXQtYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBHaXRWaXNpb25Db25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBHaXRWaXNpb25Nb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwbWljcm9zb2Z0JTJGZ2l0LWJhc2UlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEdpdFZpc2lvbk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GitVisionConfig, GitVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GitVisionConfig with microsoft/git-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GitVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GitVisionModel (with random weights) from the microsoft/git-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GitVisionModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=a("p"),b=s("Example:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Example:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f),y=!0},p:Zt,i(l){y||(T(h.$$.fragment,l),y=!0)},o(l){J(h.$$.fragment,l),y=!1},d(l){l&&o(c),l&&o(_),j(h,l)}}}function dd(k){let c,b,_,h,y;return{c(){c=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),h=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(f,"CODE",{});var W=i(_);h=n(W,"Module"),W.forEach(o),y=n(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c,f),e(c,b),e(c,_),e(_,h),e(c,y)},d(l){l&&o(c)}}}function cd(k){let c,b,_,h,y;return h=new Ut({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMEdpdFZpc2lvbk1vZGVsJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGZ2l0LWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBHaXRWaXNpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGZ2l0LWJhc2UlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, GitVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GitVisionModel.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state`}}),{c(){c=a("p"),b=s("Examples:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Examples:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f),y=!0},p:Zt,i(l){y||(T(h.$$.fragment,l),y=!0)},o(l){J(h.$$.fragment,l),y=!1},d(l){l&&o(c),l&&o(_),j(h,l)}}}function pd(k){let c,b,_,h,y;return h=new Ut({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdpdENvbmZpZyUyQyUyMEdpdE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEdJVCUyMG1pY3Jvc29mdCUyRmdpdC1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEdpdENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBtaWNyb3NvZnQlMkZnaXQtYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwR2l0TW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GitConfig, GitModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GIT microsoft/git-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GitConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the microsoft/git-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GitModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=a("p"),b=s("Examples:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Examples:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f),y=!0},p:Zt,i(l){y||(T(h.$$.fragment,l),y=!0)},o(l){J(h.$$.fragment,l),y=!1},d(l){l&&o(c),l&&o(_),j(h,l)}}}function md(k){let c,b,_,h,y;return{c(){c=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),h=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(f,"CODE",{});var W=i(_);h=n(W,"Module"),W.forEach(o),y=n(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c,f),e(c,b),e(c,_),e(_,h),e(c,y)},d(l){l&&o(c)}}}function hd(k){let c,b,_,h,y;return h=new Ut({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBdXRvTW9kZWwlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmdpdC1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZnaXQtYmFzZSUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBdGV4dCUyMCUzRCUyMCUyMnRoaXMlMjBpcyUyMGFuJTIwaW1hZ2UlMjBvZiUyMHR3byUyMGNhdHMlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;this is an image of two cats&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text, images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state`}}),{c(){c=a("p"),b=s("Examples:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Examples:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f),y=!0},p:Zt,i(l){y||(T(h.$$.fragment,l),y=!0)},o(l){J(h.$$.fragment,l),y=!1},d(l){l&&o(c),l&&o(_),j(h,l)}}}function ud(k){let c,b,_,h,y;return{c(){c=a("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),h=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(f,"CODE",{});var W=i(_);h=n(W,"Module"),W.forEach(o),y=n(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(o)},m(l,f){g(l,c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yUzRFRydWUpJTVCMCU1RCUwQXByaW50KGdlbmVyYXRlZF9jYXB0aW9uKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModelForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base-coco&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base-coco&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(pixel_values=pixel_values, max_length=<span class="hljs-number">50</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_caption)
two cats sleeping on a pink blanket <span class="hljs-built_in">next</span> to remotes.`}}),{c(){c=a("p"),b=s("Image captioning example:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Image captioning example:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f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MjBzYXklMjBhdCUyMHRoZSUyMHRvcCUzRiUyMiUwQSUwQWlucHV0X2lkcyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEcXVlc3Rpb24lMkMlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSkuaW5wdXRfaWRzJTBBaW5wdXRfaWRzJTIwJTNEJTIwJTVCcHJvY2Vzc29yLnRva2VuaXplci5jbHNfdG9rZW5faWQlNUQlMjAlMkIlMjBpbnB1dF9pZHMlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoaW5wdXRfaWRzKS51bnNxdWVlemUoMCklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUocGl4ZWxfdmFsdWVzJTNEcGl4ZWxfdmFsdWVzJTJDJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWF4X2xlbmd0aCUzRDUwKSUwQXByaW50KHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModelForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base-textvqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base-textvqa&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(repo_id=<span class="hljs-string">&quot;nielsr/textvqa-sample&quot;</span>, filename=<span class="hljs-string">&quot;bus.png&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(file_path).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;what does the front of the bus say at the top?&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = processor(text=question, add_special_tokens=<span class="hljs-literal">False</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = [processor.tokenizer.cls_token_id] + input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor(input_ids).unsqueeze(<span class="hljs-number">0</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(pixel_values=pixel_values, input_ids=input_ids, max_length=<span class="hljs-number">50</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>))
[<span class="hljs-string">&#x27;what does the front of the bus say at the top? special&#x27;</span>]`}}),{c(){c=a("p"),b=s("Visual question answering (VQA) example:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Visual question answering (VQA) example:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f),y=!0},p:Zt,i(l){y||(T(h.$$.fragment,l),y=!0)},o(l){J(h.$$.fragment,l),y=!1},d(l){l&&o(c),l&&o(_),j(h,l)}}}function _d(k){let c,b,_,h,y;return h=new Ut({props:{code:"aW1wb3J0JTIwYXYlMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnA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BzYW1wbGVfZnJhbWVfaW5kaWNlcyglMEElMjAlMjAlMjAlMjBjbGlwX2xlbiUzRG51bV9mcmFtZXMlMkMlMjBmcmFtZV9zYW1wbGVfcmF0ZSUzRDQlMkMlMjBzZWdfbGVuJTNEY29udGFpbmVyLnN0cmVhbXMudmlkZW8lNUIwJTVELmZyYW1lcyUwQSklMEFmcmFtZXMlMjAlM0QlMjByZWFkX3ZpZGVvX3B5YXYoY29udGFpbmVyJTJDJTIwaW5kaWNlcyklMEElMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEbGlzdChmcmFtZXMpJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikucGl4ZWxfdmFsdWVzJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKHBpeGVsX3ZhbHVlcyUzRHBpeGVsX3ZhbHVlcyUyQyUyMG1heF9sZW5ndGglM0Q1MCklMEElMEFwcmludCglMjJHZW5lcmF0ZWQlMjBjYXB0aW9uJTNBJTIyJTJDJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> av
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base-vatex&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;microsoft/git-base-vatex&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># set seed for reproducability</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>np.random.seed(<span class="hljs-number">45</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">read_video_pyav</span>(<span class="hljs-params">container, indices</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&#x27;&#x27;&#x27;
<span class="hljs-meta">... </span>    Decode the video with PyAV decoder.
<span class="hljs-meta">... </span>    Args:
<span class="hljs-meta">... </span>        container (\`av.container.input.InputContainer\`): PyAV container.
<span class="hljs-meta">... </span>        indices (\`List[int]\`): List of frame indices to decode.
<span class="hljs-meta">... </span>    Returns:
<span class="hljs-meta">... </span>        result (np.ndarray): np array of decoded frames of shape (num_frames, height, width, 3).
<span class="hljs-meta">... </span>    &#x27;&#x27;&#x27;</span>
<span class="hljs-meta">... </span>    frames = []
<span class="hljs-meta">... </span>    container.seek(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>    start_index = indices[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>    end_index = indices[-<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, frame <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(container.decode(video=<span class="hljs-number">0</span>)):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt; end_index:
<span class="hljs-meta">... </span>            <span class="hljs-keyword">break</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> i &gt;= start_index <span class="hljs-keyword">and</span> i <span class="hljs-keyword">in</span> indices:
<span class="hljs-meta">... </span>            frames.append(frame)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> np.stack([x.to_ndarray(<span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;rgb24&quot;</span>) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> frames])


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">sample_frame_indices</span>(<span class="hljs-params">clip_len, frame_sample_rate, seg_len</span>):
<span class="hljs-meta">... </span>    converted_len = <span class="hljs-built_in">int</span>(clip_len * frame_sample_rate)
<span class="hljs-meta">... </span>    end_idx = np.random.randint(converted_len, seg_len)
<span class="hljs-meta">... </span>    start_idx = end_idx - converted_len
<span class="hljs-meta">... </span>    indices = np.linspace(start_idx, end_idx, num=clip_len)
<span class="hljs-meta">... </span>    indices = np.clip(indices, start_idx, end_idx - <span class="hljs-number">1</span>).astype(np.int64)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> indices


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load video</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>file_path = hf_hub_download(
<span class="hljs-meta">... </span>    repo_id=<span class="hljs-string">&quot;nielsr/video-demo&quot;</span>, filename=<span class="hljs-string">&quot;eating_spaghetti.mp4&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>container = av.<span class="hljs-built_in">open</span>(file_path)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># sample frames</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_frames = model.config.num_image_with_embedding
<span class="hljs-meta">&gt;&gt;&gt; </span>indices = sample_frame_indices(
<span class="hljs-meta">... </span>    clip_len=num_frames, frame_sample_rate=<span class="hljs-number">4</span>, seg_len=container.streams.video[<span class="hljs-number">0</span>].frames
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>frames = read_video_pyav(container, indices)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(images=<span class="hljs-built_in">list</span>(frames), return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(pixel_values=pixel_values, max_length=<span class="hljs-number">50</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Generated caption:&quot;</span>, processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>))
Generated caption: [<span class="hljs-string">&#x27;a woman is sitting at a table and she is talking about the food she is holding.&#x27;</span>]`}}),{c(){c=a("p"),b=s("Video captioning example:"),_=p(),v(h.$$.fragment)},l(l){c=r(l,"P",{});var f=i(c);b=n(f,"Video captioning example:"),f.forEach(o),_=m(l),w(h.$$.fragment,l)},m(l,f){g(l,c,f),e(c,b),g(l,_,f),M(h,l,f),y=!0},p:Zt,i(l){y||(T(h.$$.fragment,l),y=!0)},o(l){J(h.$$.fragment,l),y=!1},d(l){l&&o(c),l&&o(_),j(h,l)}}}function yd(k){let c,b,_,h,y,l,f,W,on,ds,Q,ue,go,Re,sn,_o,nn,cs,X,an,Xe,rn,ln,Wt,dn,cn,ps,xt,pn,ms,zt,yo,mn,hs,Vt,hn,us,fe,Ae,un,bo,fn,gn,_n,H,yn,Bt,bn,vn,vo,wn,Mn,fs,ge,Ei,gs,_e,Tn,qe,Jn,jn,_s,A,Gn,Le,kn,In,Se,$n,Cn,ys,D,ye,wo,Ye,En,Mo,Zn,bs,Ft,Un,vs,be,Qe,Wn,He,xn,zn,Vn,Nt,Bn,Pt,Fn,ws,Rt,Nn,Ms,O,ve,To,De,Pn,Jo,Rn,Ts,V,Oe,Xn,K,An,Xt,qn,Ln,Ke,Sn,Yn,Qn,ee,Hn,At,Dn,On,qt,Kn,ea,ta,we,Js,te,Me,jo,et,oa,Go,sa,js,C,tt,na,ko,aa,ra,ot,ia,Lt,la,da,ca,st,pa,nt,ma,ha,ua,F,at,fa,oe,ga,St,_a,ya,Io,ba,va,wa,Te,Ma,Je,Gs,se,je,$o,rt,Ta,Co,Ja,ks,E,it,ja,ne,Ga,Yt,ka,Ia,lt,$a,Ca,Ea,ae,Za,Qt,Ua,Wa,Ht,xa,za,Va,Ge,Ba,ke,dt,Fa,re,Na,Dt,Pa,Ra,Eo,Xa,Aa,Is,ie,Ie,Zo,ct,qa,Uo,La,$s,B,pt,Sa,Wo,Ya,Qa,x,Ot,Ha,Da,Kt,Oa,Ka,eo,er,tr,mt,xo,or,sr,nr,zo,ar,rr,ir,$e,ht,lr,G,dr,Vo,cr,pr,Bo,mr,hr,ut,Fo,ur,fr,gr,No,_r,yr,Po,br,vr,Ro,wr,Mr,Xo,Tr,Jr,ft,Ao,jr,Gr,kr,qo,Ir,$r,Lo,Cr,Er,Cs,le,Ce,So,gt,Zr,Yo,Ur,Es,Z,_t,Wr,Qo,xr,zr,yt,Vr,to,Br,Fr,Nr,bt,Pr,vt,Rr,Xr,Ar,N,wt,qr,de,Lr,oo,Sr,Yr,Ho,Qr,Hr,Dr,Ee,Or,Ze,Zs,ce,Ue,Do,Mt,Kr,Oo,ei,Us,U,Tt,ti,Jt,oi,Ko,si,ni,ai,jt,ri,so,ii,li,di,Gt,ci,kt,pi,mi,hi,$,It,ui,pe,fi,no,gi,_i,es,yi,bi,vi,We,wi,ts,Mi,Ti,xe,Ji,ze,ji,Ve,Ws;return l=new he({}),Re=new he({}),Ye=new he({}),De=new he({}),Oe=new R({props:{name:"class transformers.GitVisionConfig",anchor:"transformers.GitVisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 16"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GitVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.GitVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.GitVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.GitVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.GitVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.GitVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.GitVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> \`<code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.GitVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.GitVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.GitVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/configuration_git.py#L31"}}),we=new Et({props:{anchor:"transformers.GitVisionConfig.example",$$slots:{default:[ld]},$$scope:{ctx:k}}}),et=new he({}),tt=new R({props:{name:"class transformers.GitVisionModel",anchor:"transformers.GitVisionModel",parameters:[{name:"config",val:": GitVisionConfig"}],parametersDescription:[{anchor:"transformers.GitVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitConfig">GitConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/modeling_git.py#L993"}}),at=new R({props:{name:"forward",anchor:"transformers.GitVisionModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GitVisionModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.GitVisionModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GitVisionModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GitVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/modeling_git.py#L1007",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.git.configuration_git.GitVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new Ci({props:{$$slots:{default:[dd]},$$scope:{ctx:k}}}),Je=new Et({props:{anchor:"transformers.GitVisionModel.forward.example",$$slots:{default:[cd]},$$scope:{ctx:k}}}),rt=new he({}),it=new R({props:{name:"class transformers.GitConfig",anchor:"transformers.GitConfig",parameters:[{name:"vision_config",val:" = None"},{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 6"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 1024"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"position_embedding_type",val:" = 'absolute'"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"bos_token_id",val:" = 101"},{name:"eos_token_id",val:" = 102"},{name:"num_image_with_embedding",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GitConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitVisionConfig">GitVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.GitConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the GIT model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitModel">GitModel</a>.`,name:"vocab_size"},{anchor:"transformers.GitConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.GitConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.GitConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.GitConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.GitConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.GitConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.GitConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.GitConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.GitConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.GitConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.GitConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;absolute&quot;</code>) &#x2014;
Type of position embedding. Choose one of <code>&quot;absolute&quot;</code>, <code>&quot;relative_key&quot;</code>, <code>&quot;relative_key_query&quot;</code>. For
positional embeddings use <code>&quot;absolute&quot;</code>. For more information on <code>&quot;relative_key&quot;</code>, please refer to
<a href="https://arxiv.org/abs/1803.02155" rel="nofollow">Self-Attention with Relative Position Representations (Shaw et al.)</a>.
For more information on <code>&quot;relative_key_query&quot;</code>, please refer to <em>Method 4</em> in <a href="https://arxiv.org/abs/2009.13658" rel="nofollow">Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)</a>.`,name:"position_embedding_type"},{anchor:"transformers.GitConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.GitConfig.num_image_with_embedding",description:`<strong>num_image_with_embedding</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of temporal embeddings to add, in case the model is used for video captioning/VQA.`,name:"num_image_with_embedding"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/configuration_git.py#L127"}}),Ge=new Et({props:{anchor:"transformers.GitConfig.example",$$slots:{default:[pd]},$$scope:{ctx:k}}}),dt=new R({props:{name:"to_dict",anchor:"transformers.GitConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/configuration_git.py#L241"}}),ct=new he({}),pt=new R({props:{name:"class transformers.GitProcessor",anchor:"transformers.GitProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.GitProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.GitProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/processing_git.py#L23"}}),ht=new R({props:{name:"__call__",anchor:"transformers.GitProcessor.__call__",parameters:[{name:"text",val:" = None"},{name:"images",val:" = None"},{name:"return_tensors",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GitProcessor.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
(pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
<code>is_split_into_words=True</code> (to lift the ambiguity with a batch of sequences).`,name:"text"},{anchor:"transformers.GitProcessor.__call__.images",description:`<strong>images</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.Tensor</code>, <code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, <code>List[torch.Tensor]</code>) &#x2014;
The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
number of channels, H and W are image height and width.`,name:"images"},{anchor:"transformers.GitProcessor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors of a particular framework. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return NumPy <code>np.ndarray</code> objects.</li>
<li><code>&apos;jax&apos;</code>: Return JAX <code>jnp.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/processing_git.py#L44",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li><strong>input_ids</strong> \u2014 List of token ids to be fed to a model. Returned when <code>text</code> is not <code>None</code>.</li>
<li><strong>attention_mask</strong> \u2014 List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>\u201Cattention_mask\u201D</em> is in <code>self.model_input_names</code> and if <code>text</code> is not
<code>None</code>).</li>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model. Returned when <code>images</code> is not <code>None</code>.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),gt=new he({}),_t=new R({props:{name:"class transformers.GitModel",anchor:"transformers.GitModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GitModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitConfig">GitConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/modeling_git.py#L1065"}}),wt=new R({props:{name:"forward",anchor:"transformers.GitModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GitModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GitModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GitModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GitModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.GitModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GitModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GitModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GitModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GitModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GitModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GitModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/modeling_git.py#L1155",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitConfig"
>GitConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ee=new Ci({props:{$$slots:{default:[md]},$$scope:{ctx:k}}}),Ze=new Et({props:{anchor:"transformers.GitModel.forward.example",$$slots:{default:[hd]},$$scope:{ctx:k}}}),Mt=new he({}),Tt=new R({props:{name:"class transformers.GitForCausalLM",anchor:"transformers.GitForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GitForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitConfig">GitConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/modeling_git.py#L1326"}}),It=new R({props:{name:"forward",anchor:"transformers.GitForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.Tensor]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.GitForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GitForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GitForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GitForCausalLM.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__">CLIPImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.GitForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.GitForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.GitForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.GitForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.GitForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GitForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the left-to-right language modeling loss (next word prediction). Indices should be in
<code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are
ignored (masked), the loss is only computed for the tokens with labels n <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.GitForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.GitForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/git/modeling_git.py#L1342",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitConfig"
>GitConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),We=new Ci({props:{$$slots:{default:[ud]},$$scope:{ctx:k}}}),xe=new Et({props:{anchor:"transformers.GitForCausalLM.forward.example",$$slots:{default:[fd]},$$scope:{ctx:k}}}),ze=new Et({props:{anchor:"transformers.GitForCausalLM.forward.example-2",$$slots:{default:[gd]},$$scope:{ctx:k}}}),Ve=new Et({props:{anchor:"transformers.GitForCausalLM.forward.example-3",$$slots:{default:[_d]},$$scope:{ctx:k}}}),{c(){c=a("meta"),b=p(),_=a("h1"),h=a("a"),y=a("span"),v(l.$$.fragment),f=p(),W=a("span"),on=s("GIT"),ds=p(),Q=a("h2"),ue=a("a"),go=a("span"),v(Re.$$.fragment),sn=p(),_o=a("span"),nn=s("Overview"),cs=p(),X=a("p"),an=s("The GIT model was proposed in "),Xe=a("a"),rn=s("GIT: A Generative Image-to-text Transformer for Vision and Language"),ln=s(` by
Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, Lijuan Wang. GIT is a decoder-only Transformer
that leverages `),Wt=a("a"),dn=s("CLIP"),cn=s(`\u2019s vision encoder to condition the model on vision inputs besides text. The model obtains state-of-the-art results on
image captioning and visual question answering benchmarks.`),ps=p(),xt=a("p"),pn=s("The abstract from the paper is the following:"),ms=p(),zt=a("p"),yo=a("em"),mn=s("In this paper, we design and train a Generative Image-to-text Transformer, GIT, to unify vision-language tasks such as image/video captioning and question answering. While generative models provide a consistent network architecture between pre-training and fine-tuning, existing work typically contains complex structures (uni/multi-modal encoder/decoder) and depends on external modules such as object detectors/taggers and optical character recognition (OCR). In GIT, we simplify the architecture as one image encoder and one text decoder under a single language modeling task. We also scale up the pre-training data and the model size to boost the model performance. Without bells and whistles, our GIT establishes new state of the arts on 12 challenging benchmarks with a large margin. For instance, our model surpasses the human performance for the first time on TextCaps (138.2 vs. 125.5 in CIDEr). Furthermore, we present a new scheme of generation-based image classification and scene text recognition, achieving decent performance on standard benchmarks."),hs=p(),Vt=a("p"),hn=s("Tips:"),us=p(),fe=a("ul"),Ae=a("li"),un=s("GIT is implemented in a very similar way to GPT-2, the only difference being that the model is also conditioned on "),bo=a("code"),fn=s("pixel_values"),gn=s("."),_n=p(),H=a("li"),yn=s("One can use "),Bt=a("a"),bn=s("GitProcessor"),vn=s(" to prepare images for the model, and the "),vo=a("code"),wn=s("generate"),Mn=s(" method for autoregressive generation."),fs=p(),ge=a("img"),gs=p(),_e=a("small"),Tn=s("GIT architecture. Taken from the "),qe=a("a"),Jn=s("original paper"),jn=s("."),_s=p(),A=a("p"),Gn=s("This model was contributed by "),Le=a("a"),kn=s("nielsr"),In=s(`.
The original code can be found `),Se=a("a"),$n=s("here"),Cn=s("."),ys=p(),D=a("h2"),ye=a("a"),wo=a("span"),v(Ye.$$.fragment),En=p(),Mo=a("span"),Zn=s("Resources"),bs=p(),Ft=a("p"),Un=s("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GIT."),vs=p(),be=a("ul"),Qe=a("li"),Wn=s("Demo notebooks regarding inference + fine-tuning GIT on custom data can be found "),He=a("a"),xn=s("here"),zn=s("."),Vn=p(),Nt=a("li"),Bn=s("See also: "),Pt=a("a"),Fn=s("Causal language modeling task guide"),ws=p(),Rt=a("p"),Nn=s(`If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),Ms=p(),O=a("h2"),ve=a("a"),To=a("span"),v(De.$$.fragment),Pn=p(),Jo=a("span"),Rn=s("GitVisionConfig"),Ts=p(),V=a("div"),v(Oe.$$.fragment),Xn=p(),K=a("p"),An=s("This is the configuration class to store the configuration of a "),Xt=a("a"),qn=s("GitVisionModel"),Ln=s(`. It is used to instantiate a GIT
vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the vision encoder of the GIT
`),Ke=a("a"),Sn=s("microsoft/git-base"),Yn=s(" architecture."),Qn=p(),ee=a("p"),Hn=s("Configuration objects inherit from "),At=a("a"),Dn=s("PretrainedConfig"),On=s(` and can be used to control the model outputs. Read the
documentation from `),qt=a("a"),Kn=s("PretrainedConfig"),ea=s(" for more information."),ta=p(),v(we.$$.fragment),Js=p(),te=a("h2"),Me=a("a"),jo=a("span"),v(et.$$.fragment),oa=p(),Go=a("span"),sa=s("GitVisionModel"),js=p(),C=a("div"),v(tt.$$.fragment),na=p(),ko=a("p"),aa=s("The vision model from CLIP, used in GIT, without any head or projection on top."),ra=p(),ot=a("p"),ia=s("This model inherits from "),Lt=a("a"),la=s("PreTrainedModel"),da=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ca=p(),st=a("p"),pa=s("This model is also a PyTorch "),nt=a("a"),ma=s("torch.nn.Module"),ha=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ua=p(),F=a("div"),v(at.$$.fragment),fa=p(),oe=a("p"),ga=s("The "),St=a("a"),_a=s("GitVisionModel"),ya=s(" forward method, overrides the "),Io=a("code"),ba=s("__call__"),va=s(" special method."),wa=p(),v(Te.$$.fragment),Ma=p(),v(Je.$$.fragment),Gs=p(),se=a("h2"),je=a("a"),$o=a("span"),v(rt.$$.fragment),Ta=p(),Co=a("span"),Ja=s("GitConfig"),ks=p(),E=a("div"),v(it.$$.fragment),ja=p(),ne=a("p"),Ga=s("This is the configuration class to store the configuration of a "),Yt=a("a"),ka=s("GitModel"),Ia=s(`. It is used to instantiate a GIT model
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the GIT
`),lt=a("a"),$a=s("microsoft/git-base"),Ca=s(" architecture."),Ea=p(),ae=a("p"),Za=s("Configuration objects inherit from "),Qt=a("a"),Ua=s("PretrainedConfig"),Wa=s(` and can be used to control the model outputs. Read the
documentation from `),Ht=a("a"),xa=s("PretrainedConfig"),za=s(" for more information."),Va=p(),v(Ge.$$.fragment),Ba=p(),ke=a("div"),v(dt.$$.fragment),Fa=p(),re=a("p"),Na=s("Serializes this instance to a Python dictionary. Override the default "),Dt=a("a"),Pa=s("to_dict()"),Ra=s(`. Returns:
`),Eo=a("code"),Xa=s("Dict[str, any]"),Aa=s(": Dictionary of all the attributes that make up this configuration instance,"),Is=p(),ie=a("h2"),Ie=a("a"),Zo=a("span"),v(ct.$$.fragment),qa=p(),Uo=a("span"),La=s("GitProcessor"),$s=p(),B=a("div"),v(pt.$$.fragment),Sa=p(),Wo=a("p"),Ya=s("Constructs a GIT processor which wraps a CLIP image processor and a BERT tokenizer into a single processor."),Qa=p(),x=a("p"),Ot=a("a"),Ha=s("GitProcessor"),Da=s(" offers all the functionalities of "),Kt=a("a"),Oa=s("CLIPImageProcessor"),Ka=s(" and "),eo=a("a"),er=s("BertTokenizerFast"),tr=s(`. See the
`),mt=a("a"),xo=a("strong"),or=s("call"),sr=s("()"),nr=s(" and "),zo=a("code"),ar=s("decode()"),rr=s(" for more information."),ir=p(),$e=a("div"),v(ht.$$.fragment),lr=p(),G=a("p"),dr=s("Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the "),Vo=a("code"),cr=s("text"),pr=s(`
and `),Bo=a("code"),mr=s("kwargs"),hr=s(" arguments to BertTokenizerFast\u2019s "),ut=a("a"),Fo=a("strong"),ur=s("call"),fr=s("()"),gr=s(" if "),No=a("code"),_r=s("text"),yr=s(" is not "),Po=a("code"),br=s("None"),vr=s(` to encode
the text. To prepare the image(s), this method forwards the `),Ro=a("code"),wr=s("images"),Mr=s(" and "),Xo=a("code"),Tr=s("kwrags"),Jr=s(` arguments to
CLIPImageProcessor\u2019s `),ft=a("a"),Ao=a("strong"),jr=s("call"),Gr=s("()"),kr=s(" if "),qo=a("code"),Ir=s("images"),$r=s(" is not "),Lo=a("code"),Cr=s("None"),Er=s(`. Please refer to the doctsring
of the above two methods for more information.`),Cs=p(),le=a("h2"),Ce=a("a"),So=a("span"),v(gt.$$.fragment),Zr=p(),Yo=a("span"),Ur=s("GitModel"),Es=p(),Z=a("div"),v(_t.$$.fragment),Wr=p(),Qo=a("p"),xr=s("The bare GIT Model transformer consisting of a CLIP image encoder and text decoder outputting raw hidden-states without any specific head on top."),zr=p(),yt=a("p"),Vr=s("This model inherits from "),to=a("a"),Br=s("PreTrainedModel"),Fr=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Nr=p(),bt=a("p"),Pr=s("This model is also a PyTorch "),vt=a("a"),Rr=s("torch.nn.Module"),Xr=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ar=p(),N=a("div"),v(wt.$$.fragment),qr=p(),de=a("p"),Lr=s("The "),oo=a("a"),Sr=s("GitModel"),Yr=s(" forward method, overrides the "),Ho=a("code"),Qr=s("__call__"),Hr=s(" special method."),Dr=p(),v(Ee.$$.fragment),Or=p(),v(Ze.$$.fragment),Zs=p(),ce=a("h2"),Ue=a("a"),Do=a("span"),v(Mt.$$.fragment),Kr=p(),Oo=a("span"),ei=s("GitForCausalLM"),Us=p(),U=a("div"),v(Tt.$$.fragment),ti=p(),Jt=a("p"),oi=s("GIT Model with a "),Ko=a("code"),si=s("language modeling"),ni=s(" head on top for autoregressive language modeling."),ai=p(),jt=a("p"),ri=s("This model inherits from "),so=a("a"),ii=s("PreTrainedModel"),li=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),di=p(),Gt=a("p"),ci=s("This model is also a PyTorch "),kt=a("a"),pi=s("torch.nn.Module"),mi=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),hi=p(),$=a("div"),v(It.$$.fragment),ui=p(),pe=a("p"),fi=s("The "),no=a("a"),gi=s("GitForCausalLM"),_i=s(" forward method, overrides the "),es=a("code"),yi=s("__call__"),bi=s(" special method."),vi=p(),v(We.$$.fragment),wi=p(),ts=a("p"),Mi=s("Examples:"),Ti=p(),v(xe.$$.fragment),Ji=p(),v(ze.$$.fragment),ji=p(),v(Ve.$$.fragment),this.h()},l(t){const u=ad('[data-svelte="svelte-1phssyn"]',document.head);c=r(u,"META",{name:!0,content:!0}),u.forEach(o),b=m(t),_=r(t,"H1",{class:!0});var $t=i(_);h=r($t,"A",{id:!0,class:!0,href:!0});var os=i(h);y=r(os,"SPAN",{});var ss=i(y);w(l.$$.fragment,ss),ss.forEach(o),os.forEach(o),f=m($t),W=r($t,"SPAN",{});var ns=i(W);on=n(ns,"GIT"),ns.forEach(o),$t.forEach(o),ds=m(t),Q=r(t,"H2",{class:!0});var Ct=i(Q);ue=r(Ct,"A",{id:!0,class:!0,href:!0});var as=i(ue);go=r(as,"SPAN",{});var rs=i(go);w(Re.$$.fragment,rs),rs.forEach(o),as.forEach(o),sn=m(Ct),_o=r(Ct,"SPAN",{});var is=i(_o);nn=n(is,"Overview"),is.forEach(o),Ct.forEach(o),cs=m(t),X=r(t,"P",{});var me=i(X);an=n(me,"The GIT model was proposed in "),Xe=r(me,"A",{href:!0,rel:!0});var ls=i(Xe);rn=n(ls,"GIT: A Generative Image-to-text Transformer for Vision and Language"),ls.forEach(o),ln=n(me,` by
Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, Lijuan Wang. GIT is a decoder-only Transformer
that leverages `),Wt=r(me,"A",{href:!0});var Zi=i(Wt);dn=n(Zi,"CLIP"),Zi.forEach(o),cn=n(me,`\u2019s vision encoder to condition the model on vision inputs besides text. The model obtains state-of-the-art results on
image captioning and visual question answering benchmarks.`),me.forEach(o),ps=m(t),xt=r(t,"P",{});var Ui=i(xt);pn=n(Ui,"The abstract from the paper is the following:"),Ui.forEach(o),ms=m(t),zt=r(t,"P",{});var Wi=i(zt);yo=r(Wi,"EM",{});var xi=i(yo);mn=n(xi,"In this paper, we design and train a Generative Image-to-text Transformer, GIT, to unify vision-language tasks such as image/video captioning and question answering. While generative models provide a consistent network architecture between pre-training and fine-tuning, existing work typically contains complex structures (uni/multi-modal encoder/decoder) and depends on external modules such as object detectors/taggers and optical character recognition (OCR). In GIT, we simplify the architecture as one image encoder and one text decoder under a single language modeling task. We also scale up the pre-training data and the model size to boost the model performance. Without bells and whistles, our GIT establishes new state of the arts on 12 challenging benchmarks with a large margin. For instance, our model surpasses the human performance for the first time on TextCaps (138.2 vs. 125.5 in CIDEr). Furthermore, we present a new scheme of generation-based image classification and scene text recognition, achieving decent performance on standard benchmarks."),xi.forEach(o),Wi.forEach(o),hs=m(t),Vt=r(t,"P",{});var zi=i(Vt);hn=n(zi,"Tips:"),zi.forEach(o),us=m(t),fe=r(t,"UL",{});var xs=i(fe);Ae=r(xs,"LI",{});var zs=i(Ae);un=n(zs,"GIT is implemented in a very similar way to GPT-2, the only difference being that the model is also conditioned on "),bo=r(zs,"CODE",{});var Vi=i(bo);fn=n(Vi,"pixel_values"),Vi.forEach(o),gn=n(zs,"."),zs.forEach(o),_n=m(xs),H=r(xs,"LI",{});var ao=i(H);yn=n(ao,"One can use "),Bt=r(ao,"A",{href:!0});var Bi=i(Bt);bn=n(Bi,"GitProcessor"),Bi.forEach(o),vn=n(ao," to prepare images for the model, and the "),vo=r(ao,"CODE",{});var Fi=i(vo);wn=n(Fi,"generate"),Fi.forEach(o),Mn=n(ao," method for autoregressive generation."),ao.forEach(o),xs.forEach(o),fs=m(t),ge=r(t,"IMG",{src:!0,alt:!0,width:!0}),gs=m(t),_e=r(t,"SMALL",{});var Vs=i(_e);Tn=n(Vs,"GIT architecture. Taken from the "),qe=r(Vs,"A",{href:!0,target:!0});var Ni=i(qe);Jn=n(Ni,"original paper"),Ni.forEach(o),jn=n(Vs,"."),Vs.forEach(o),_s=m(t),A=r(t,"P",{});var ro=i(A);Gn=n(ro,"This model was contributed by "),Le=r(ro,"A",{href:!0,rel:!0});var Pi=i(Le);kn=n(Pi,"nielsr"),Pi.forEach(o),In=n(ro,`.
The original code can be found `),Se=r(ro,"A",{href:!0,rel:!0});var Ri=i(Se);$n=n(Ri,"here"),Ri.forEach(o),Cn=n(ro,"."),ro.forEach(o),ys=m(t),D=r(t,"H2",{class:!0});var Bs=i(D);ye=r(Bs,"A",{id:!0,class:!0,href:!0});var Xi=i(ye);wo=r(Xi,"SPAN",{});var Ai=i(wo);w(Ye.$$.fragment,Ai),Ai.forEach(o),Xi.forEach(o),En=m(Bs),Mo=r(Bs,"SPAN",{});var qi=i(Mo);Zn=n(qi,"Resources"),qi.forEach(o),Bs.forEach(o),bs=m(t),Ft=r(t,"P",{});var Li=i(Ft);Un=n(Li,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GIT."),Li.forEach(o),vs=m(t),be=r(t,"UL",{});var Fs=i(be);Qe=r(Fs,"LI",{});var Ns=i(Qe);Wn=n(Ns,"Demo notebooks regarding inference + fine-tuning GIT on custom data can be found "),He=r(Ns,"A",{href:!0,rel:!0});var Si=i(He);xn=n(Si,"here"),Si.forEach(o),zn=n(Ns,"."),Ns.forEach(o),Vn=m(Fs),Nt=r(Fs,"LI",{});var Gi=i(Nt);Bn=n(Gi,"See also: "),Pt=r(Gi,"A",{href:!0});var Yi=i(Pt);Fn=n(Yi,"Causal language modeling task guide"),Yi.forEach(o),Gi.forEach(o),Fs.forEach(o),ws=m(t),Rt=r(t,"P",{});var Qi=i(Rt);Nn=n(Qi,`If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),Qi.forEach(o),Ms=m(t),O=r(t,"H2",{class:!0});var Ps=i(O);ve=r(Ps,"A",{id:!0,class:!0,href:!0});var Hi=i(ve);To=r(Hi,"SPAN",{});var Di=i(To);w(De.$$.fragment,Di),Di.forEach(o),Hi.forEach(o),Pn=m(Ps),Jo=r(Ps,"SPAN",{});var Oi=i(Jo);Rn=n(Oi,"GitVisionConfig"),Oi.forEach(o),Ps.forEach(o),Ts=m(t),V=r(t,"DIV",{class:!0});var Be=i(V);w(Oe.$$.fragment,Be),Xn=m(Be),K=r(Be,"P",{});var io=i(K);An=n(io,"This is the configuration class to store the configuration of a "),Xt=r(io,"A",{href:!0});var Ki=i(Xt);qn=n(Ki,"GitVisionModel"),Ki.forEach(o),Ln=n(io,`. It is used to instantiate a GIT
vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the vision encoder of the GIT
`),Ke=r(io,"A",{href:!0,rel:!0});var el=i(Ke);Sn=n(el,"microsoft/git-base"),el.forEach(o),Yn=n(io," architecture."),io.forEach(o),Qn=m(Be),ee=r(Be,"P",{});var lo=i(ee);Hn=n(lo,"Configuration objects inherit from "),At=r(lo,"A",{href:!0});var tl=i(At);Dn=n(tl,"PretrainedConfig"),tl.forEach(o),On=n(lo,` and can be used to control the model outputs. Read the
documentation from `),qt=r(lo,"A",{href:!0});var ol=i(qt);Kn=n(ol,"PretrainedConfig"),ol.forEach(o),ea=n(lo," for more information."),lo.forEach(o),ta=m(Be),w(we.$$.fragment,Be),Be.forEach(o),Js=m(t),te=r(t,"H2",{class:!0});var Rs=i(te);Me=r(Rs,"A",{id:!0,class:!0,href:!0});var sl=i(Me);jo=r(sl,"SPAN",{});var nl=i(jo);w(et.$$.fragment,nl),nl.forEach(o),sl.forEach(o),oa=m(Rs),Go=r(Rs,"SPAN",{});var al=i(Go);sa=n(al,"GitVisionModel"),al.forEach(o),Rs.forEach(o),js=m(t),C=r(t,"DIV",{class:!0});var q=i(C);w(tt.$$.fragment,q),na=m(q),ko=r(q,"P",{});var rl=i(ko);aa=n(rl,"The vision model from CLIP, used in GIT, without any head or projection on top."),rl.forEach(o),ra=m(q),ot=r(q,"P",{});var Xs=i(ot);ia=n(Xs,"This model inherits from "),Lt=r(Xs,"A",{href:!0});var il=i(Lt);la=n(il,"PreTrainedModel"),il.forEach(o),da=n(Xs,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Xs.forEach(o),ca=m(q),st=r(q,"P",{});var As=i(st);pa=n(As,"This model is also a PyTorch "),nt=r(As,"A",{href:!0,rel:!0});var ll=i(nt);ma=n(ll,"torch.nn.Module"),ll.forEach(o),ha=n(As,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),As.forEach(o),ua=m(q),F=r(q,"DIV",{class:!0});var Fe=i(F);w(at.$$.fragment,Fe),fa=m(Fe),oe=r(Fe,"P",{});var co=i(oe);ga=n(co,"The "),St=r(co,"A",{href:!0});var dl=i(St);_a=n(dl,"GitVisionModel"),dl.forEach(o),ya=n(co," forward method, overrides the "),Io=r(co,"CODE",{});var cl=i(Io);ba=n(cl,"__call__"),cl.forEach(o),va=n(co," special method."),co.forEach(o),wa=m(Fe),w(Te.$$.fragment,Fe),Ma=m(Fe),w(Je.$$.fragment,Fe),Fe.forEach(o),q.forEach(o),Gs=m(t),se=r(t,"H2",{class:!0});var qs=i(se);je=r(qs,"A",{id:!0,class:!0,href:!0});var pl=i(je);$o=r(pl,"SPAN",{});var ml=i($o);w(rt.$$.fragment,ml),ml.forEach(o),pl.forEach(o),Ta=m(qs),Co=r(qs,"SPAN",{});var hl=i(Co);Ja=n(hl,"GitConfig"),hl.forEach(o),qs.forEach(o),ks=m(t),E=r(t,"DIV",{class:!0});var L=i(E);w(it.$$.fragment,L),ja=m(L),ne=r(L,"P",{});var po=i(ne);Ga=n(po,"This is the configuration class to store the configuration of a "),Yt=r(po,"A",{href:!0});var ul=i(Yt);ka=n(ul,"GitModel"),ul.forEach(o),Ia=n(po,`. It is used to instantiate a GIT model
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration to that of the GIT
`),lt=r(po,"A",{href:!0,rel:!0});var fl=i(lt);$a=n(fl,"microsoft/git-base"),fl.forEach(o),Ca=n(po," architecture."),po.forEach(o),Ea=m(L),ae=r(L,"P",{});var mo=i(ae);Za=n(mo,"Configuration objects inherit from "),Qt=r(mo,"A",{href:!0});var gl=i(Qt);Ua=n(gl,"PretrainedConfig"),gl.forEach(o),Wa=n(mo,` and can be used to control the model outputs. Read the
documentation from `),Ht=r(mo,"A",{href:!0});var _l=i(Ht);xa=n(_l,"PretrainedConfig"),_l.forEach(o),za=n(mo," for more information."),mo.forEach(o),Va=m(L),w(Ge.$$.fragment,L),Ba=m(L),ke=r(L,"DIV",{class:!0});var Ls=i(ke);w(dt.$$.fragment,Ls),Fa=m(Ls),re=r(Ls,"P",{});var ho=i(re);Na=n(ho,"Serializes this instance to a Python dictionary. Override the default "),Dt=r(ho,"A",{href:!0});var yl=i(Dt);Pa=n(yl,"to_dict()"),yl.forEach(o),Ra=n(ho,`. Returns:
`),Eo=r(ho,"CODE",{});var bl=i(Eo);Xa=n(bl,"Dict[str, any]"),bl.forEach(o),Aa=n(ho,": Dictionary of all the attributes that make up this configuration instance,"),ho.forEach(o),Ls.forEach(o),L.forEach(o),Is=m(t),ie=r(t,"H2",{class:!0});var Ss=i(ie);Ie=r(Ss,"A",{id:!0,class:!0,href:!0});var vl=i(Ie);Zo=r(vl,"SPAN",{});var wl=i(Zo);w(ct.$$.fragment,wl),wl.forEach(o),vl.forEach(o),qa=m(Ss),Uo=r(Ss,"SPAN",{});var Ml=i(Uo);La=n(Ml,"GitProcessor"),Ml.forEach(o),Ss.forEach(o),$s=m(t),B=r(t,"DIV",{class:!0});var Ne=i(B);w(pt.$$.fragment,Ne),Sa=m(Ne),Wo=r(Ne,"P",{});var Tl=i(Wo);Ya=n(Tl,"Constructs a GIT processor which wraps a CLIP image processor and a BERT tokenizer into a single processor."),Tl.forEach(o),Qa=m(Ne),x=r(Ne,"P",{});var P=i(x);Ot=r(P,"A",{href:!0});var Jl=i(Ot);Ha=n(Jl,"GitProcessor"),Jl.forEach(o),Da=n(P," offers all the functionalities of "),Kt=r(P,"A",{href:!0});var jl=i(Kt);Oa=n(jl,"CLIPImageProcessor"),jl.forEach(o),Ka=n(P," and "),eo=r(P,"A",{href:!0});var Gl=i(eo);er=n(Gl,"BertTokenizerFast"),Gl.forEach(o),tr=n(P,`. See the
`),mt=r(P,"A",{href:!0});var ki=i(mt);xo=r(ki,"STRONG",{});var kl=i(xo);or=n(kl,"call"),kl.forEach(o),sr=n(ki,"()"),ki.forEach(o),nr=n(P," and "),zo=r(P,"CODE",{});var Il=i(zo);ar=n(Il,"decode()"),Il.forEach(o),rr=n(P," for more information."),P.forEach(o),ir=m(Ne),$e=r(Ne,"DIV",{class:!0});var Ys=i($e);w(ht.$$.fragment,Ys),lr=m(Ys),G=r(Ys,"P",{});var I=i(G);dr=n(I,"Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the "),Vo=r(I,"CODE",{});var $l=i(Vo);cr=n($l,"text"),$l.forEach(o),pr=n(I,`
and `),Bo=r(I,"CODE",{});var Cl=i(Bo);mr=n(Cl,"kwargs"),Cl.forEach(o),hr=n(I," arguments to BertTokenizerFast\u2019s "),ut=r(I,"A",{href:!0});var Ii=i(ut);Fo=r(Ii,"STRONG",{});var El=i(Fo);ur=n(El,"call"),El.forEach(o),fr=n(Ii,"()"),Ii.forEach(o),gr=n(I," if "),No=r(I,"CODE",{});var Zl=i(No);_r=n(Zl,"text"),Zl.forEach(o),yr=n(I," is not "),Po=r(I,"CODE",{});var Ul=i(Po);br=n(Ul,"None"),Ul.forEach(o),vr=n(I,` to encode
the text. To prepare the image(s), this method forwards the `),Ro=r(I,"CODE",{});var Wl=i(Ro);wr=n(Wl,"images"),Wl.forEach(o),Mr=n(I," and "),Xo=r(I,"CODE",{});var xl=i(Xo);Tr=n(xl,"kwrags"),xl.forEach(o),Jr=n(I,` arguments to
CLIPImageProcessor\u2019s `),ft=r(I,"A",{href:!0});var $i=i(ft);Ao=r($i,"STRONG",{});var zl=i(Ao);jr=n(zl,"call"),zl.forEach(o),Gr=n($i,"()"),$i.forEach(o),kr=n(I," if "),qo=r(I,"CODE",{});var Vl=i(qo);Ir=n(Vl,"images"),Vl.forEach(o),$r=n(I," is not "),Lo=r(I,"CODE",{});var Bl=i(Lo);Cr=n(Bl,"None"),Bl.forEach(o),Er=n(I,`. Please refer to the doctsring
of the above two methods for more information.`),I.forEach(o),Ys.forEach(o),Ne.forEach(o),Cs=m(t),le=r(t,"H2",{class:!0});var Qs=i(le);Ce=r(Qs,"A",{id:!0,class:!0,href:!0});var Fl=i(Ce);So=r(Fl,"SPAN",{});var Nl=i(So);w(gt.$$.fragment,Nl),Nl.forEach(o),Fl.forEach(o),Zr=m(Qs),Yo=r(Qs,"SPAN",{});var Pl=i(Yo);Ur=n(Pl,"GitModel"),Pl.forEach(o),Qs.forEach(o),Es=m(t),Z=r(t,"DIV",{class:!0});var S=i(Z);w(_t.$$.fragment,S),Wr=m(S),Qo=r(S,"P",{});var Rl=i(Qo);xr=n(Rl,"The bare GIT Model transformer consisting of a CLIP image encoder and text decoder outputting raw hidden-states without any specific head on top."),Rl.forEach(o),zr=m(S),yt=r(S,"P",{});var Hs=i(yt);Vr=n(Hs,"This model inherits from "),to=r(Hs,"A",{href:!0});var Xl=i(to);Br=n(Xl,"PreTrainedModel"),Xl.forEach(o),Fr=n(Hs,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Hs.forEach(o),Nr=m(S),bt=r(S,"P",{});var Ds=i(bt);Pr=n(Ds,"This model is also a PyTorch "),vt=r(Ds,"A",{href:!0,rel:!0});var Al=i(vt);Rr=n(Al,"torch.nn.Module"),Al.forEach(o),Xr=n(Ds,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ds.forEach(o),Ar=m(S),N=r(S,"DIV",{class:!0});var Pe=i(N);w(wt.$$.fragment,Pe),qr=m(Pe),de=r(Pe,"P",{});var uo=i(de);Lr=n(uo,"The "),oo=r(uo,"A",{href:!0});var ql=i(oo);Sr=n(ql,"GitModel"),ql.forEach(o),Yr=n(uo," forward method, overrides the "),Ho=r(uo,"CODE",{});var Ll=i(Ho);Qr=n(Ll,"__call__"),Ll.forEach(o),Hr=n(uo," special method."),uo.forEach(o),Dr=m(Pe),w(Ee.$$.fragment,Pe),Or=m(Pe),w(Ze.$$.fragment,Pe),Pe.forEach(o),S.forEach(o),Zs=m(t),ce=r(t,"H2",{class:!0});var Os=i(ce);Ue=r(Os,"A",{id:!0,class:!0,href:!0});var Sl=i(Ue);Do=r(Sl,"SPAN",{});var Yl=i(Do);w(Mt.$$.fragment,Yl),Yl.forEach(o),Sl.forEach(o),Kr=m(Os),Oo=r(Os,"SPAN",{});var Ql=i(Oo);ei=n(Ql,"GitForCausalLM"),Ql.forEach(o),Os.forEach(o),Us=m(t),U=r(t,"DIV",{class:!0});var Y=i(U);w(Tt.$$.fragment,Y),ti=m(Y),Jt=r(Y,"P",{});var Ks=i(Jt);oi=n(Ks,"GIT Model with a "),Ko=r(Ks,"CODE",{});var Hl=i(Ko);si=n(Hl,"language modeling"),Hl.forEach(o),ni=n(Ks," head on top for autoregressive language modeling."),Ks.forEach(o),ai=m(Y),jt=r(Y,"P",{});var en=i(jt);ri=n(en,"This model inherits from "),so=r(en,"A",{href:!0});var Dl=i(so);ii=n(Dl,"PreTrainedModel"),Dl.forEach(o),li=n(en,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),en.forEach(o),di=m(Y),Gt=r(Y,"P",{});var tn=i(Gt);ci=n(tn,"This model is also a PyTorch "),kt=r(tn,"A",{href:!0,rel:!0});var Ol=i(kt);pi=n(Ol,"torch.nn.Module"),Ol.forEach(o),mi=n(tn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),tn.forEach(o),hi=m(Y),$=r(Y,"DIV",{class:!0});var z=i($);w(It.$$.fragment,z),ui=m(z),pe=r(z,"P",{});var fo=i(pe);fi=n(fo,"The "),no=r(fo,"A",{href:!0});var Kl=i(no);gi=n(Kl,"GitForCausalLM"),Kl.forEach(o),_i=n(fo," forward method, overrides the "),es=r(fo,"CODE",{});var ed=i(es);yi=n(ed,"__call__"),ed.forEach(o),bi=n(fo," special method."),fo.forEach(o),vi=m(z),w(We.$$.fragment,z),wi=m(z),ts=r(z,"P",{});var td=i(ts);Mi=n(td,"Examples:"),td.forEach(o),Ti=m(z),w(xe.$$.fragment,z),Ji=m(z),w(ze.$$.fragment,z),ji=m(z),w(Ve.$$.fragment,z),z.forEach(o),Y.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(bd)),d(h,"id","git"),d(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(h,"href","#git"),d(_,"class","relative group"),d(ue,"id","overview"),d(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ue,"href","#overview"),d(Q,"class","relative group"),d(Xe,"href","https://arxiv.org/abs/2205.14100"),d(Xe,"rel","nofollow"),d(Wt,"href","clip"),d(Bt,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitProcessor"),rd(ge.src,Ei="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/git_architecture.jpg")||d(ge,"src",Ei),d(ge,"alt","drawing"),d(ge,"width","600"),d(qe,"href","https://arxiv.org/abs/2205.14100"),d(qe,"target","_blank"),d(Le,"href","https://huggingface.co/nielsr"),d(Le,"rel","nofollow"),d(Se,"href","https://github.com/microsoft/GenerativeImage2Text"),d(Se,"rel","nofollow"),d(ye,"id","resources"),d(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ye,"href","#resources"),d(D,"class","relative group"),d(He,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/GIT"),d(He,"rel","nofollow"),d(Pt,"href","../tasks/language_modeling"),d(ve,"id","transformers.GitVisionConfig"),d(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ve,"href","#transformers.GitVisionConfig"),d(O,"class","relative group"),d(Xt,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitVisionModel"),d(Ke,"href","https://huggingface.co/microsoft/git-base"),d(Ke,"rel","nofollow"),d(At,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(qt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Me,"id","transformers.GitVisionModel"),d(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Me,"href","#transformers.GitVisionModel"),d(te,"class","relative group"),d(Lt,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),d(nt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(nt,"rel","nofollow"),d(St,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitVisionModel"),d(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(je,"id","transformers.GitConfig"),d(je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(je,"href","#transformers.GitConfig"),d(se,"class","relative group"),d(Yt,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitModel"),d(lt,"href","https://huggingface.co/microsoft/git-base"),d(lt,"rel","nofollow"),d(Qt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ht,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Dt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),d(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ie,"id","transformers.GitProcessor"),d(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ie,"href","#transformers.GitProcessor"),d(ie,"class","relative group"),d(Ot,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitProcessor"),d(Kt,"href","/docs/transformers/v4.30.0/en/model_doc/clip#transformers.CLIPImageProcessor"),d(eo,"href","/docs/transformers/v4.30.0/en/model_doc/bert#transformers.BertTokenizerFast"),d(mt,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitProcessor.__call__"),d(ut,"href","/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__"),d(ft,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__"),d($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ce,"id","transformers.GitModel"),d(Ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ce,"href","#transformers.GitModel"),d(le,"class","relative group"),d(to,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),d(vt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(vt,"rel","nofollow"),d(oo,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitModel"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ue,"id","transformers.GitForCausalLM"),d(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ue,"href","#transformers.GitForCausalLM"),d(ce,"class","relative group"),d(so,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),d(kt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(kt,"rel","nofollow"),d(no,"href","/docs/transformers/v4.30.0/en/model_doc/git#transformers.GitForCausalLM"),d($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,u){e(document.head,c),g(t,b,u),g(t,_,u),e(_,h),e(h,y),M(l,y,null),e(_,f),e(_,W),e(W,on),g(t,ds,u),g(t,Q,u),e(Q,ue),e(ue,go),M(Re,go,null),e(Q,sn),e(Q,_o),e(_o,nn),g(t,cs,u),g(t,X,u),e(X,an),e(X,Xe),e(Xe,rn),e(X,ln),e(X,Wt),e(Wt,dn),e(X,cn),g(t,ps,u),g(t,xt,u),e(xt,pn),g(t,ms,u),g(t,zt,u),e(zt,yo),e(yo,mn),g(t,hs,u),g(t,Vt,u),e(Vt,hn),g(t,us,u),g(t,fe,u),e(fe,Ae),e(Ae,un),e(Ae,bo),e(bo,fn),e(Ae,gn),e(fe,_n),e(fe,H),e(H,yn),e(H,Bt),e(Bt,bn),e(H,vn),e(H,vo),e(vo,wn),e(H,Mn),g(t,fs,u),g(t,ge,u),g(t,gs,u),g(t,_e,u),e(_e,Tn),e(_e,qe),e(qe,Jn),e(_e,jn),g(t,_s,u),g(t,A,u),e(A,Gn),e(A,Le),e(Le,kn),e(A,In),e(A,Se),e(Se,$n),e(A,Cn),g(t,ys,u),g(t,D,u),e(D,ye),e(ye,wo),M(Ye,wo,null),e(D,En),e(D,Mo),e(Mo,Zn),g(t,bs,u),g(t,Ft,u),e(Ft,Un),g(t,vs,u),g(t,be,u),e(be,Qe),e(Qe,Wn),e(Qe,He),e(He,xn),e(Qe,zn),e(be,Vn),e(be,Nt),e(Nt,Bn),e(Nt,Pt),e(Pt,Fn),g(t,ws,u),g(t,Rt,u),e(Rt,Nn),g(t,Ms,u),g(t,O,u),e(O,ve),e(ve,To),M(De,To,null),e(O,Pn),e(O,Jo),e(Jo,Rn),g(t,Ts,u),g(t,V,u),M(Oe,V,null),e(V,Xn),e(V,K),e(K,An),e(K,Xt),e(Xt,qn),e(K,Ln),e(K,Ke),e(Ke,Sn),e(K,Yn),e(V,Qn),e(V,ee),e(ee,Hn),e(ee,At),e(At,Dn),e(ee,On),e(ee,qt),e(qt,Kn),e(ee,ea),e(V,ta),M(we,V,null),g(t,Js,u),g(t,te,u),e(te,Me),e(Me,jo),M(et,jo,null),e(te,oa),e(te,Go),e(Go,sa),g(t,js,u),g(t,C,u),M(tt,C,null),e(C,na),e(C,ko),e(ko,aa),e(C,ra),e(C,ot),e(ot,ia),e(ot,Lt),e(Lt,la),e(ot,da),e(C,ca),e(C,st),e(st,pa),e(st,nt),e(nt,ma),e(st,ha),e(C,ua),e(C,F),M(at,F,null),e(F,fa),e(F,oe),e(oe,ga),e(oe,St),e(St,_a),e(oe,ya),e(oe,Io),e(Io,ba),e(oe,va),e(F,wa),M(Te,F,null),e(F,Ma),M(Je,F,null),g(t,Gs,u),g(t,se,u),e(se,je),e(je,$o),M(rt,$o,null),e(se,Ta),e(se,Co),e(Co,Ja),g(t,ks,u),g(t,E,u),M(it,E,null),e(E,ja),e(E,ne),e(ne,Ga),e(ne,Yt),e(Yt,ka),e(ne,Ia),e(ne,lt),e(lt,$a),e(ne,Ca),e(E,Ea),e(E,ae),e(ae,Za),e(ae,Qt),e(Qt,Ua),e(ae,Wa),e(ae,Ht),e(Ht,xa),e(ae,za),e(E,Va),M(Ge,E,null),e(E,Ba),e(E,ke),M(dt,ke,null),e(ke,Fa),e(ke,re),e(re,Na),e(re,Dt),e(Dt,Pa),e(re,Ra),e(re,Eo),e(Eo,Xa),e(re,Aa),g(t,Is,u),g(t,ie,u),e(ie,Ie),e(Ie,Zo),M(ct,Zo,null),e(ie,qa),e(ie,Uo),e(Uo,La),g(t,$s,u),g(t,B,u),M(pt,B,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(so,ii),e(jt,li),e(U,di),e(U,Gt),e(Gt,ci),e(Gt,kt),e(kt,pi),e(Gt,mi),e(U,hi),e(U,$),M(It,$,null),e($,ui),e($,pe),e(pe,fi),e(pe,no),e(no,gi),e(pe,_i),e(pe,es),e(es,yi),e(pe,bi),e($,vi),M(We,$,null),e($,wi),e($,ts),e(ts,Mi),e($,Ti),M(xe,$,null),e($,Ji),M(ze,$,null),e($,ji),M(Ve,$,null),Ws=!0},p(t,[u]){const $t={};u&2&&($t.$$scope={dirty:u,ctx:t}),we.$set($t);const os={};u&2&&(os.$$scope={dirty:u,ctx:t}),Te.$set(os);const ss={};u&2&&(ss.$$scope={dirty:u,ctx:t}),Je.$set(ss);const ns={};u&2&&(ns.$$scope={dirty:u,ctx:t}),Ge.$set(ns);const Ct={};u&2&&(Ct.$$scope={dirty:u,ctx:t}),Ee.$set(Ct);const as={};u&2&&(as.$$scope={dirty:u,ctx:t}),Ze.$set(as);const rs={};u&2&&(rs.$$scope={dirty:u,ctx:t}),We.$set(rs);const is={};u&2&&(is.$$scope={dirty:u,ctx:t}),xe.$set(is);const me={};u&2&&(me.$$scope={dirty:u,ctx:t}),ze.$set(me);const ls={};u&2&&(ls.$$scope={dirty:u,ctx:t}),Ve.$set(ls)},i(t){Ws||(T(l.$$.fragment,t),T(Re.$$.fragment,t),T(Ye.$$.fragment,t),T(De.$$.fragment,t),T(Oe.$$.fragment,t),T(we.$$.fragment,t),T(et.$$.fragment,t),T(tt.$$.fragment,t),T(at.$$.fragment,t),T(Te.$$.fragment,t),T(Je.$$.fragment,t),T(rt.$$.fragment,t),T(it.$$.fragment,t),T(Ge.$$.fragment,t),T(dt.$$.fragment,t),T(ct.$$.fragment,t),T(pt.$$.fragment,t),T(ht.$$.fragment,t),T(gt.$$.fragment,t),T(_t.$$.fragment,t),T(wt.$$.fragment,t),T(Ee.$$.fragment,t),T(Ze.$$.fragment,t),T(Mt.$$.fragment,t),T(Tt.$$.fragment,t),T(It.$$.fragment,t),T(We.$$.fragment,t),T(xe.$$.fragment,t),T(ze.$$.fragment,t),T(Ve.$$.fragment,t),Ws=!0)},o(t){J(l.$$.fragment,t),J(Re.$$.fragment,t),J(Ye.$$.fragment,t),J(De.$$.fragment,t),J(Oe.$$.fragment,t),J(we.$$.fragment,t),J(et.$$.fragment,t),J(tt.$$.fragment,t),J(at.$$.fragment,t),J(Te.$$.fragment,t),J(Je.$$.fragment,t),J(rt.$$.fragment,t),J(it.$$.fragment,t),J(Ge.$$.fragment,t),J(dt.$$.fragment,t),J(ct.$$.fragment,t),J(pt.$$.fragment,t),J(ht.$$.fragment,t),J(gt.$$.fragment,t),J(_t.$$.fragment,t),J(wt.$$.fragment,t),J(Ee.$$.fragment,t),J(Ze.$$.fragment,t),J(Mt.$$.fragment,t),J(Tt.$$.fragment,t),J(It.$$.fragment,t),J(We.$$.fragment,t),J(xe.$$.fragment,t),J(ze.$$.fragment,t),J(Ve.$$.fragment,t),Ws=!1},d(t){o(c),t&&o(b),t&&o(_),j(l),t&&o(ds),t&&o(Q),j(Re),t&&o(cs),t&&o(X),t&&o(ps),t&&o(xt),t&&o(ms),t&&o(zt),t&&o(hs),t&&o(Vt),t&&o(us),t&&o(fe),t&&o(fs),t&&o(ge),t&&o(gs),t&&o(_e),t&&o(_s),t&&o(A),t&&o(ys),t&&o(D),j(Ye),t&&o(bs),t&&o(Ft),t&&o(vs),t&&o(be),t&&o(ws),t&&o(Rt),t&&o(Ms),t&&o(O),j(De),t&&o(Ts),t&&o(V),j(Oe),j(we),t&&o(Js),t&&o(te),j(et),t&&o(js),t&&o(C),j(tt),j(at),j(Te),j(Je),t&&o(Gs),t&&o(se),j(rt),t&&o(ks),t&&o(E),j(it),j(Ge),j(dt),t&&o(Is),t&&o(ie),j(ct),t&&o($s),t&&o(B),j(pt),j(ht),t&&o(Cs),t&&o(le),j(gt),t&&o(Es),t&&o(Z),j(_t),j(wt),j(Ee),j(Ze),t&&o(Zs),t&&o(ce),j(Mt),t&&o(Us),t&&o(U),j(Tt),j(It),j(We),j(xe),j(ze),j(Ve)}}}const bd={local:"git",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.GitVisionConfig",title:"GitVisionConfig"},{local:"transformers.GitVisionModel",title:"GitVisionModel"},{local:"transformers.GitConfig",title:"GitConfig"},{local:"transformers.GitProcessor",title:"GitProcessor"},{local:"transformers.GitModel",title:"GitModel"},{local:"transformers.GitForCausalLM",title:"GitForCausalLM"}],title:"GIT"};function vd(k){return id(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class kd extends od{constructor(c){super();sd(this,c,vd,yd,nd,{})}}export{kd as default,bd as metadata};
