import{S as Nl,i as Pl,s as Rl,e as a,k as p,w as v,t as s,M as Xl,c as r,d as o,m,a as i,x as w,h as n,b as d,N as Al,G as e,g,y as M,q as T,o as J,B as j,v as ql,L as $t}from"../../chunks/vendor-hf-doc-builder.js";import{T as gi}from"../../chunks/Tip-hf-doc-builder.js";import{D as S}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ct}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as pe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as It}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ll(k){let c,b,_,h,y;return h=new Ct({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:$t,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 Sl(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 U=i(_);h=n(U,"Module"),U.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 Yl(k){let c,b,_,h,y;return h=new Ct({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:$t,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 Ql(k){let c,b,_,h,y;return h=new Ct({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:$t,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 Hl(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 U=i(_);h=n(U,"Module"),U.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 Dl(k){let c,b,_,h,y;return h=new Ct({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:$t,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 Ol(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 U=i(_);h=n(U,"Module"),U.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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sX3Rva2VucyUzRFRydWUpJTVCMCU1RCUwQXByaW50KGdlbmVyYXRlZF9jYXB0aW9uKQ==",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,_,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lMjBidXMlMjBzYXklMjBhdCUyMHRoZSUyMHRvcCUzRiUyMiUwQSUwQWlucHV0X2lkcyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEcXVlc3Rpb24lMkMlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSkuaW5wdXRfaWRzJTBBaW5wdXRfaWRzJTIwJTNEJTIwJTVCcHJvY2Vzc29yLnRva2VuaXplci5jbHNfdG9rZW5faWQlNUQlMjAlMkIlMjBpbnB1dF9pZHMlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoaW5wdXRfaWRzKS51bnNxdWVlemUoMCklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUocGl4ZWxfdmFsdWVzJTNEcGl4ZWxfdmFsdWVzJTJDJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWF4X2xlbmd0aCUzRDUwKSUwQXByaW50KHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",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:$t,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 td(k){let c,b,_,h,y;return h=new Ct({props:{code:"aW1wb3J0JTIwYXYlMEFpbXBvcnQlMjBudW1weSUyMGFzJ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M0QlMjBzYW1wbGVfZnJhbWVfaW5kaWNlcyglMEElMjAlMjAlMjAlMjBjbGlwX2xlbiUzRG51bV9mcmFtZXMlMkMlMjBmcmFtZV9zYW1wbGVfcmF0ZSUzRDQlMkMlMjBzZWdfbGVuJTNEY29udGFpbmVyLnN0cmVhbXMudmlkZW8lNUIwJTVELmZyYW1lcyUwQSklMEFmcmFtZXMlMjAlM0QlMjByZWFkX3ZpZGVvX3B5YXYoY29udGFpbmVyJTJDJTIwaW5kaWNlcyklMEElMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEbGlzdChmcmFtZXMpJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikucGl4ZWxfdmFsdWVzJTBBJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKHBpeGVsX3ZhbHVlcyUzRHBpeGVsX3ZhbHVlcyUyQyUyMG1heF9sZW5ndGglM0Q1MCklMEElMEFwcmludCglMjJHZW5lcmF0ZWQlMjBjYXB0aW9uJTNBJTIyJTJDJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKQ==",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:$t,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 od(k){let c,b,_,h,y,l,f,U,Qs,ss,Y,me,po,Ne,Hs,mo,Ds,ns,R,Os,Pe,Ks,en,Zt,tn,on,as,Et,sn,rs,Ut,ho,nn,is,Wt,an,ls,he,Re,rn,uo,ln,dn,cn,Q,pn,xt,mn,hn,fo,un,fn,ds,ue,_i,cs,fe,gn,Xe,_n,yn,ps,X,bn,Ae,vn,wn,qe,Mn,Tn,ms,H,ge,go,Le,Jn,_o,jn,hs,zt,Gn,us,_e,Se,kn,Ye,In,$n,Cn,Bt,Zn,Vt,En,fs,Ft,Un,gs,D,ye,yo,Qe,Wn,bo,xn,_s,z,He,zn,O,Bn,Nt,Vn,Fn,De,Nn,Pn,Rn,K,Xn,Pt,An,qn,Rt,Ln,Sn,Yn,be,ys,ee,ve,vo,Oe,Qn,wo,Hn,bs,C,Ke,Dn,Mo,On,Kn,et,ea,Xt,ta,oa,sa,tt,na,ot,aa,ra,ia,F,st,la,te,da,At,ca,pa,To,ma,ha,ua,we,fa,Me,vs,oe,Te,Jo,nt,ga,jo,_a,ws,B,at,ya,se,ba,qt,va,wa,rt,Ma,Ta,Ja,ne,ja,Lt,Ga,ka,St,Ia,$a,Ca,Je,Ms,ae,je,Go,it,Za,ko,Ea,Ts,V,lt,Ua,Io,Wa,xa,W,Yt,za,Ba,Qt,Va,Fa,Ht,Na,Pa,dt,$o,Ra,Xa,Aa,Co,qa,La,Sa,Ge,ct,Ya,G,Qa,Zo,Ha,Da,Eo,Oa,Ka,pt,Uo,er,tr,or,Wo,sr,nr,xo,ar,rr,zo,ir,lr,Bo,dr,cr,mt,Vo,pr,mr,hr,Fo,ur,fr,No,gr,_r,Js,re,ke,Po,ht,yr,Ro,br,js,Z,ut,vr,Xo,wr,Mr,ft,Tr,Dt,Jr,jr,Gr,gt,kr,_t,Ir,$r,Cr,N,yt,Zr,ie,Er,Ot,Ur,Wr,Ao,xr,zr,Br,Ie,Vr,$e,Gs,le,Ce,qo,bt,Fr,Lo,Nr,ks,E,vt,Pr,wt,Rr,So,Xr,Ar,qr,Mt,Lr,Kt,Sr,Yr,Qr,Tt,Hr,Jt,Dr,Or,Kr,$,jt,ei,de,ti,eo,oi,si,Yo,ni,ai,ri,Ze,ii,Qo,li,di,Ee,ci,Ue,pi,We,Is;return l=new pe({}),Ne=new pe({}),Le=new pe({}),Qe=new pe({}),He=new S({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.32.0/src/transformers/models/git/configuration_git.py#L30"}}),be=new It({props:{anchor:"transformers.GitVisionConfig.example",$$slots:{default:[Ll]},$$scope:{ctx:k}}}),Oe=new pe({}),Ke=new S({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.32.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.32.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.32.0/src/transformers/models/git/modeling_git.py#L995"}}),st=new S({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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.32.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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.32.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.32.0/src/transformers/models/git/modeling_git.py#L1009",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.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.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),we=new gi({props:{$$slots:{default:[Sl]},$$scope:{ctx:k}}}),Me=new It({props:{anchor:"transformers.GitVisionModel.forward.example",$$slots:{default:[Yl]},$$scope:{ctx:k}}}),nt=new pe({}),at=new S({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.32.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.32.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.32.0/src/transformers/models/git/configuration_git.py#L128"}}),Je=new It({props:{anchor:"transformers.GitConfig.example",$$slots:{default:[Ql]},$$scope:{ctx:k}}}),it=new pe({}),lt=new S({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.32.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.32.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.32.0/src/transformers/models/git/processing_git.py#L23"}}),ct=new S({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.32.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.32.0/src/transformers/models/git/processing_git.py#L44",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.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.32.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),ht=new pe({}),ut=new S({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.32.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.32.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.32.0/src/transformers/models/git/modeling_git.py#L1067"}}),yt=new S({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.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.32.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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.32.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.32.0/src/transformers/models/git/modeling_git.py#L1157",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.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.32.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.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ie=new gi({props:{$$slots:{default:[Hl]},$$scope:{ctx:k}}}),$e=new It({props:{anchor:"transformers.GitModel.forward.example",$$slots:{default:[Dl]},$$scope:{ctx:k}}}),bt=new pe({}),vt=new S({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.32.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.32.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.32.0/src/transformers/models/git/modeling_git.py#L1329"}}),jt=new S({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.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.32.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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.32.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.32.0/src/transformers/models/git/modeling_git.py#L1347",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.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.32.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.32.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ze=new gi({props:{$$slots:{default:[Ol]},$$scope:{ctx:k}}}),Ee=new It({props:{anchor:"transformers.GitForCausalLM.forward.example",$$slots:{default:[Kl]},$$scope:{ctx:k}}}),Ue=new It({props:{anchor:"transformers.GitForCausalLM.forward.example-2",$$slots:{default:[ed]},$$scope:{ctx:k}}}),We=new It({props:{anchor:"transformers.GitForCausalLM.forward.example-3",$$slots:{default:[td]},$$scope:{ctx:k}}}),{c(){c=a("meta"),b=p(),_=a("h1"),h=a("a"),y=a("span"),v(l.$$.fragment),f=p(),U=a("span"),Qs=s("GIT"),ss=p(),Y=a("h2"),me=a("a"),po=a("span"),v(Ne.$$.fragment),Hs=p(),mo=a("span"),Ds=s("Overview"),ns=p(),R=a("p"),Os=s("The GIT model was proposed in "),Pe=a("a"),Ks=s("GIT: A Generative Image-to-text Transformer for Vision and Language"),en=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 `),Zt=a("a"),tn=s("CLIP"),on=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.`),as=p(),Et=a("p"),sn=s("The abstract from the paper is the following:"),rs=p(),Ut=a("p"),ho=a("em"),nn=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."),is=p(),Wt=a("p"),an=s("Tips:"),ls=p(),he=a("ul"),Re=a("li"),rn=s("GIT is implemented in a very similar way to GPT-2, the only difference being that the model is also conditioned on "),uo=a("code"),ln=s("pixel_values"),dn=s("."),cn=p(),Q=a("li"),pn=s("One can use "),xt=a("a"),mn=s("GitProcessor"),hn=s(" to prepare images for the model, and the "),fo=a("code"),un=s("generate"),fn=s(" method for autoregressive generation."),ds=p(),ue=a("img"),cs=p(),fe=a("small"),gn=s("GIT architecture. Taken from the "),Xe=a("a"),_n=s("original paper"),yn=s("."),ps=p(),X=a("p"),bn=s("This model was contributed by "),Ae=a("a"),vn=s("nielsr"),wn=s(`.
The original code can be found `),qe=a("a"),Mn=s("here"),Tn=s("."),ms=p(),H=a("h2"),ge=a("a"),go=a("span"),v(Le.$$.fragment),Jn=p(),_o=a("span"),jn=s("Resources"),hs=p(),zt=a("p"),Gn=s("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GIT."),us=p(),_e=a("ul"),Se=a("li"),kn=s("Demo notebooks regarding inference + fine-tuning GIT on custom data can be found "),Ye=a("a"),In=s("here"),$n=s("."),Cn=p(),Bt=a("li"),Zn=s("See also: "),Vt=a("a"),En=s("Causal language modeling task guide"),fs=p(),Ft=a("p"),Un=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.`),gs=p(),D=a("h2"),ye=a("a"),yo=a("span"),v(Qe.$$.fragment),Wn=p(),bo=a("span"),xn=s("GitVisionConfig"),_s=p(),z=a("div"),v(He.$$.fragment),zn=p(),O=a("p"),Bn=s("This is the configuration class to store the configuration of a "),Nt=a("a"),Vn=s("GitVisionModel"),Fn=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
`),De=a("a"),Nn=s("microsoft/git-base"),Pn=s(" architecture."),Rn=p(),K=a("p"),Xn=s("Configuration objects inherit from "),Pt=a("a"),An=s("PretrainedConfig"),qn=s(` and can be used to control the model outputs. Read the
documentation from `),Rt=a("a"),Ln=s("PretrainedConfig"),Sn=s(" for more information."),Yn=p(),v(be.$$.fragment),ys=p(),ee=a("h2"),ve=a("a"),vo=a("span"),v(Oe.$$.fragment),Qn=p(),wo=a("span"),Hn=s("GitVisionModel"),bs=p(),C=a("div"),v(Ke.$$.fragment),Dn=p(),Mo=a("p"),On=s("The vision model from CLIP, used in GIT, without any head or projection on top."),Kn=p(),et=a("p"),ea=s("This model inherits from "),Xt=a("a"),ta=s("PreTrainedModel"),oa=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.)`),sa=p(),tt=a("p"),na=s("This model is also a PyTorch "),ot=a("a"),aa=s("torch.nn.Module"),ra=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ia=p(),F=a("div"),v(st.$$.fragment),la=p(),te=a("p"),da=s("The "),At=a("a"),ca=s("GitVisionModel"),pa=s(" forward method, overrides the "),To=a("code"),ma=s("__call__"),ha=s(" special method."),ua=p(),v(we.$$.fragment),fa=p(),v(Me.$$.fragment),vs=p(),oe=a("h2"),Te=a("a"),Jo=a("span"),v(nt.$$.fragment),ga=p(),jo=a("span"),_a=s("GitConfig"),ws=p(),B=a("div"),v(at.$$.fragment),ya=p(),se=a("p"),ba=s("This is the configuration class to store the configuration of a "),qt=a("a"),va=s("GitModel"),wa=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
`),rt=a("a"),Ma=s("microsoft/git-base"),Ta=s(" architecture."),Ja=p(),ne=a("p"),ja=s("Configuration objects inherit from "),Lt=a("a"),Ga=s("PretrainedConfig"),ka=s(` and can be used to control the model outputs. Read the
documentation from `),St=a("a"),Ia=s("PretrainedConfig"),$a=s(" for more information."),Ca=p(),v(Je.$$.fragment),Ms=p(),ae=a("h2"),je=a("a"),Go=a("span"),v(it.$$.fragment),Za=p(),ko=a("span"),Ea=s("GitProcessor"),Ts=p(),V=a("div"),v(lt.$$.fragment),Ua=p(),Io=a("p"),Wa=s("Constructs a GIT processor which wraps a CLIP image processor and a BERT tokenizer into a single processor."),xa=p(),W=a("p"),Yt=a("a"),za=s("GitProcessor"),Ba=s(" offers all the functionalities of "),Qt=a("a"),Va=s("CLIPImageProcessor"),Fa=s(" and "),Ht=a("a"),Na=s("BertTokenizerFast"),Pa=s(`. See the
`),dt=a("a"),$o=a("strong"),Ra=s("call"),Xa=s("()"),Aa=s(" and "),Co=a("code"),qa=s("decode()"),La=s(" for more information."),Sa=p(),Ge=a("div"),v(ct.$$.fragment),Ya=p(),G=a("p"),Qa=s("Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the "),Zo=a("code"),Ha=s("text"),Da=s(`
and `),Eo=a("code"),Oa=s("kwargs"),Ka=s(" arguments to BertTokenizerFast\u2019s "),pt=a("a"),Uo=a("strong"),er=s("call"),tr=s("()"),or=s(" if "),Wo=a("code"),sr=s("text"),nr=s(" is not "),xo=a("code"),ar=s("None"),rr=s(` to encode
the text. To prepare the image(s), this method forwards the `),zo=a("code"),ir=s("images"),lr=s(" and "),Bo=a("code"),dr=s("kwrags"),cr=s(` arguments to
CLIPImageProcessor\u2019s `),mt=a("a"),Vo=a("strong"),pr=s("call"),mr=s("()"),hr=s(" if "),Fo=a("code"),ur=s("images"),fr=s(" is not "),No=a("code"),gr=s("None"),_r=s(`. Please refer to the doctsring
of the above two methods for more information.`),Js=p(),re=a("h2"),ke=a("a"),Po=a("span"),v(ht.$$.fragment),yr=p(),Ro=a("span"),br=s("GitModel"),js=p(),Z=a("div"),v(ut.$$.fragment),vr=p(),Xo=a("p"),wr=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."),Mr=p(),ft=a("p"),Tr=s("This model inherits from "),Dt=a("a"),Jr=s("PreTrainedModel"),jr=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.)`),Gr=p(),gt=a("p"),kr=s("This model is also a PyTorch "),_t=a("a"),Ir=s("torch.nn.Module"),$r=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Cr=p(),N=a("div"),v(yt.$$.fragment),Zr=p(),ie=a("p"),Er=s("The "),Ot=a("a"),Ur=s("GitModel"),Wr=s(" forward method, overrides the "),Ao=a("code"),xr=s("__call__"),zr=s(" special method."),Br=p(),v(Ie.$$.fragment),Vr=p(),v($e.$$.fragment),Gs=p(),le=a("h2"),Ce=a("a"),qo=a("span"),v(bt.$$.fragment),Fr=p(),Lo=a("span"),Nr=s("GitForCausalLM"),ks=p(),E=a("div"),v(vt.$$.fragment),Pr=p(),wt=a("p"),Rr=s("GIT Model with a "),So=a("code"),Xr=s("language modeling"),Ar=s(" head on top for autoregressive language modeling."),qr=p(),Mt=a("p"),Lr=s("This model inherits from "),Kt=a("a"),Sr=s("PreTrainedModel"),Yr=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.)`),Qr=p(),Tt=a("p"),Hr=s("This model is also a PyTorch "),Jt=a("a"),Dr=s("torch.nn.Module"),Or=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Kr=p(),$=a("div"),v(jt.$$.fragment),ei=p(),de=a("p"),ti=s("The "),eo=a("a"),oi=s("GitForCausalLM"),si=s(" forward method, overrides the "),Yo=a("code"),ni=s("__call__"),ai=s(" special method."),ri=p(),v(Ze.$$.fragment),ii=p(),Qo=a("p"),li=s("Examples:"),di=p(),v(Ee.$$.fragment),ci=p(),v(Ue.$$.fragment),pi=p(),v(We.$$.fragment),this.h()},l(t){const u=Xl('[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 Gt=i(_);h=r(Gt,"A",{id:!0,class:!0,href:!0});var Ho=i(h);y=r(Ho,"SPAN",{});var Do=i(y);w(l.$$.fragment,Do),Do.forEach(o),Ho.forEach(o),f=m(Gt),U=r(Gt,"SPAN",{});var Oo=i(U);Qs=n(Oo,"GIT"),Oo.forEach(o),Gt.forEach(o),ss=m(t),Y=r(t,"H2",{class:!0});var kt=i(Y);me=r(kt,"A",{id:!0,class:!0,href:!0});var Ko=i(me);po=r(Ko,"SPAN",{});var es=i(po);w(Ne.$$.fragment,es),es.forEach(o),Ko.forEach(o),Hs=m(kt),mo=r(kt,"SPAN",{});var ts=i(mo);Ds=n(ts,"Overview"),ts.forEach(o),kt.forEach(o),ns=m(t),R=r(t,"P",{});var ce=i(R);Os=n(ce,"The GIT model was proposed in "),Pe=r(ce,"A",{href:!0,rel:!0});var os=i(Pe);Ks=n(os,"GIT: A Generative Image-to-text Transformer for Vision and Language"),os.forEach(o),en=n(ce,` 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 `),Zt=r(ce,"A",{href:!0});var yi=i(Zt);tn=n(yi,"CLIP"),yi.forEach(o),on=n(ce,`\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.`),ce.forEach(o),as=m(t),Et=r(t,"P",{});var bi=i(Et);sn=n(bi,"The abstract from the paper is the following:"),bi.forEach(o),rs=m(t),Ut=r(t,"P",{});var vi=i(Ut);ho=r(vi,"EM",{});var wi=i(ho);nn=n(wi,"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."),wi.forEach(o),vi.forEach(o),is=m(t),Wt=r(t,"P",{});var Mi=i(Wt);an=n(Mi,"Tips:"),Mi.forEach(o),ls=m(t),he=r(t,"UL",{});var $s=i(he);Re=r($s,"LI",{});var Cs=i(Re);rn=n(Cs,"GIT is implemented in a very similar way to GPT-2, the only difference being that the model is also conditioned on "),uo=r(Cs,"CODE",{});var Ti=i(uo);ln=n(Ti,"pixel_values"),Ti.forEach(o),dn=n(Cs,"."),Cs.forEach(o),cn=m($s),Q=r($s,"LI",{});var to=i(Q);pn=n(to,"One can use "),xt=r(to,"A",{href:!0});var Ji=i(xt);mn=n(Ji,"GitProcessor"),Ji.forEach(o),hn=n(to," to prepare images for the model, and the "),fo=r(to,"CODE",{});var ji=i(fo);un=n(ji,"generate"),ji.forEach(o),fn=n(to," method for autoregressive generation."),to.forEach(o),$s.forEach(o),ds=m(t),ue=r(t,"IMG",{src:!0,alt:!0,width:!0}),cs=m(t),fe=r(t,"SMALL",{});var Zs=i(fe);gn=n(Zs,"GIT architecture. Taken from the "),Xe=r(Zs,"A",{href:!0,target:!0});var Gi=i(Xe);_n=n(Gi,"original paper"),Gi.forEach(o),yn=n(Zs,"."),Zs.forEach(o),ps=m(t),X=r(t,"P",{});var oo=i(X);bn=n(oo,"This model was contributed by "),Ae=r(oo,"A",{href:!0,rel:!0});var ki=i(Ae);vn=n(ki,"nielsr"),ki.forEach(o),wn=n(oo,`.
The original code can be found `),qe=r(oo,"A",{href:!0,rel:!0});var Ii=i(qe);Mn=n(Ii,"here"),Ii.forEach(o),Tn=n(oo,"."),oo.forEach(o),ms=m(t),H=r(t,"H2",{class:!0});var Es=i(H);ge=r(Es,"A",{id:!0,class:!0,href:!0});var $i=i(ge);go=r($i,"SPAN",{});var Ci=i(go);w(Le.$$.fragment,Ci),Ci.forEach(o),$i.forEach(o),Jn=m(Es),_o=r(Es,"SPAN",{});var Zi=i(_o);jn=n(Zi,"Resources"),Zi.forEach(o),Es.forEach(o),hs=m(t),zt=r(t,"P",{});var Ei=i(zt);Gn=n(Ei,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GIT."),Ei.forEach(o),us=m(t),_e=r(t,"UL",{});var Us=i(_e);Se=r(Us,"LI",{});var Ws=i(Se);kn=n(Ws,"Demo notebooks regarding inference + fine-tuning GIT on custom data can be found "),Ye=r(Ws,"A",{href:!0,rel:!0});var Ui=i(Ye);In=n(Ui,"here"),Ui.forEach(o),$n=n(Ws,"."),Ws.forEach(o),Cn=m(Us),Bt=r(Us,"LI",{});var mi=i(Bt);Zn=n(mi,"See also: "),Vt=r(mi,"A",{href:!0});var Wi=i(Vt);En=n(Wi,"Causal language modeling task guide"),Wi.forEach(o),mi.forEach(o),Us.forEach(o),fs=m(t),Ft=r(t,"P",{});var xi=i(Ft);Un=n(xi,`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.`),xi.forEach(o),gs=m(t),D=r(t,"H2",{class:!0});var xs=i(D);ye=r(xs,"A",{id:!0,class:!0,href:!0});var zi=i(ye);yo=r(zi,"SPAN",{});var Bi=i(yo);w(Qe.$$.fragment,Bi),Bi.forEach(o),zi.forEach(o),Wn=m(xs),bo=r(xs,"SPAN",{});var Vi=i(bo);xn=n(Vi,"GitVisionConfig"),Vi.forEach(o),xs.forEach(o),_s=m(t),z=r(t,"DIV",{class:!0});var xe=i(z);w(He.$$.fragment,xe),zn=m(xe),O=r(xe,"P",{});var so=i(O);Bn=n(so,"This is the configuration class to store the configuration of a "),Nt=r(so,"A",{href:!0});var Fi=i(Nt);Vn=n(Fi,"GitVisionModel"),Fi.forEach(o),Fn=n(so,`. 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
`),De=r(so,"A",{href:!0,rel:!0});var Ni=i(De);Nn=n(Ni,"microsoft/git-base"),Ni.forEach(o),Pn=n(so," architecture."),so.forEach(o),Rn=m(xe),K=r(xe,"P",{});var no=i(K);Xn=n(no,"Configuration objects inherit from "),Pt=r(no,"A",{href:!0});var Pi=i(Pt);An=n(Pi,"PretrainedConfig"),Pi.forEach(o),qn=n(no,` and can be used to control the model outputs. Read the
documentation from `),Rt=r(no,"A",{href:!0});var Ri=i(Rt);Ln=n(Ri,"PretrainedConfig"),Ri.forEach(o),Sn=n(no," for more information."),no.forEach(o),Yn=m(xe),w(be.$$.fragment,xe),xe.forEach(o),ys=m(t),ee=r(t,"H2",{class:!0});var zs=i(ee);ve=r(zs,"A",{id:!0,class:!0,href:!0});var Xi=i(ve);vo=r(Xi,"SPAN",{});var Ai=i(vo);w(Oe.$$.fragment,Ai),Ai.forEach(o),Xi.forEach(o),Qn=m(zs),wo=r(zs,"SPAN",{});var qi=i(wo);Hn=n(qi,"GitVisionModel"),qi.forEach(o),zs.forEach(o),bs=m(t),C=r(t,"DIV",{class:!0});var A=i(C);w(Ke.$$.fragment,A),Dn=m(A),Mo=r(A,"P",{});var Li=i(Mo);On=n(Li,"The vision model from CLIP, used in GIT, without any head or projection on top."),Li.forEach(o),Kn=m(A),et=r(A,"P",{});var Bs=i(et);ea=n(Bs,"This model inherits from "),Xt=r(Bs,"A",{href:!0});var Si=i(Xt);ta=n(Si,"PreTrainedModel"),Si.forEach(o),oa=n(Bs,`. 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.)`),Bs.forEach(o),sa=m(A),tt=r(A,"P",{});var Vs=i(tt);na=n(Vs,"This model is also a PyTorch "),ot=r(Vs,"A",{href:!0,rel:!0});var Yi=i(ot);aa=n(Yi,"torch.nn.Module"),Yi.forEach(o),ra=n(Vs,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Vs.forEach(o),ia=m(A),F=r(A,"DIV",{class:!0});var ze=i(F);w(st.$$.fragment,ze),la=m(ze),te=r(ze,"P",{});var ao=i(te);da=n(ao,"The "),At=r(ao,"A",{href:!0});var Qi=i(At);ca=n(Qi,"GitVisionModel"),Qi.forEach(o),pa=n(ao," forward method, overrides the "),To=r(ao,"CODE",{});var Hi=i(To);ma=n(Hi,"__call__"),Hi.forEach(o),ha=n(ao," special method."),ao.forEach(o),ua=m(ze),w(we.$$.fragment,ze),fa=m(ze),w(Me.$$.fragment,ze),ze.forEach(o),A.forEach(o),vs=m(t),oe=r(t,"H2",{class:!0});var Fs=i(oe);Te=r(Fs,"A",{id:!0,class:!0,href:!0});var Di=i(Te);Jo=r(Di,"SPAN",{});var Oi=i(Jo);w(nt.$$.fragment,Oi),Oi.forEach(o),Di.forEach(o),ga=m(Fs),jo=r(Fs,"SPAN",{});var Ki=i(jo);_a=n(Ki,"GitConfig"),Ki.forEach(o),Fs.forEach(o),ws=m(t),B=r(t,"DIV",{class:!0});var Be=i(B);w(at.$$.fragment,Be),ya=m(Be),se=r(Be,"P",{});var ro=i(se);ba=n(ro,"This is the configuration class to store the configuration of a "),qt=r(ro,"A",{href:!0});var el=i(qt);va=n(el,"GitModel"),el.forEach(o),wa=n(ro,`. 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
`),rt=r(ro,"A",{href:!0,rel:!0});var tl=i(rt);Ma=n(tl,"microsoft/git-base"),tl.forEach(o),Ta=n(ro," architecture."),ro.forEach(o),Ja=m(Be),ne=r(Be,"P",{});var io=i(ne);ja=n(io,"Configuration objects inherit from "),Lt=r(io,"A",{href:!0});var ol=i(Lt);Ga=n(ol,"PretrainedConfig"),ol.forEach(o),ka=n(io,` and can be used to control the model outputs. Read the
documentation from `),St=r(io,"A",{href:!0});var sl=i(St);Ia=n(sl,"PretrainedConfig"),sl.forEach(o),$a=n(io," for more information."),io.forEach(o),Ca=m(Be),w(Je.$$.fragment,Be),Be.forEach(o),Ms=m(t),ae=r(t,"H2",{class:!0});var Ns=i(ae);je=r(Ns,"A",{id:!0,class:!0,href:!0});var nl=i(je);Go=r(nl,"SPAN",{});var al=i(Go);w(it.$$.fragment,al),al.forEach(o),nl.forEach(o),Za=m(Ns),ko=r(Ns,"SPAN",{});var rl=i(ko);Ea=n(rl,"GitProcessor"),rl.forEach(o),Ns.forEach(o),Ts=m(t),V=r(t,"DIV",{class:!0});var Ve=i(V);w(lt.$$.fragment,Ve),Ua=m(Ve),Io=r(Ve,"P",{});var il=i(Io);Wa=n(il,"Constructs a GIT processor which wraps a CLIP image processor and a BERT tokenizer into a single processor."),il.forEach(o),xa=m(Ve),W=r(Ve,"P",{});var P=i(W);Yt=r(P,"A",{href:!0});var ll=i(Yt);za=n(ll,"GitProcessor"),ll.forEach(o),Ba=n(P," offers all the functionalities of "),Qt=r(P,"A",{href:!0});var dl=i(Qt);Va=n(dl,"CLIPImageProcessor"),dl.forEach(o),Fa=n(P," and "),Ht=r(P,"A",{href:!0});var cl=i(Ht);Na=n(cl,"BertTokenizerFast"),cl.forEach(o),Pa=n(P,`. See the
`),dt=r(P,"A",{href:!0});var hi=i(dt);$o=r(hi,"STRONG",{});var pl=i($o);Ra=n(pl,"call"),pl.forEach(o),Xa=n(hi,"()"),hi.forEach(o),Aa=n(P," and "),Co=r(P,"CODE",{});var ml=i(Co);qa=n(ml,"decode()"),ml.forEach(o),La=n(P," for more information."),P.forEach(o),Sa=m(Ve),Ge=r(Ve,"DIV",{class:!0});var Ps=i(Ge);w(ct.$$.fragment,Ps),Ya=m(Ps),G=r(Ps,"P",{});var I=i(G);Qa=n(I,"Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the "),Zo=r(I,"CODE",{});var hl=i(Zo);Ha=n(hl,"text"),hl.forEach(o),Da=n(I,`
and `),Eo=r(I,"CODE",{});var ul=i(Eo);Oa=n(ul,"kwargs"),ul.forEach(o),Ka=n(I," arguments to BertTokenizerFast\u2019s "),pt=r(I,"A",{href:!0});var ui=i(pt);Uo=r(ui,"STRONG",{});var fl=i(Uo);er=n(fl,"call"),fl.forEach(o),tr=n(ui,"()"),ui.forEach(o),or=n(I," if "),Wo=r(I,"CODE",{});var gl=i(Wo);sr=n(gl,"text"),gl.forEach(o),nr=n(I," is not "),xo=r(I,"CODE",{});var _l=i(xo);ar=n(_l,"None"),_l.forEach(o),rr=n(I,` to encode
the text. To prepare the image(s), this method forwards the `),zo=r(I,"CODE",{});var yl=i(zo);ir=n(yl,"images"),yl.forEach(o),lr=n(I," and "),Bo=r(I,"CODE",{});var bl=i(Bo);dr=n(bl,"kwrags"),bl.forEach(o),cr=n(I,` arguments to
CLIPImageProcessor\u2019s `),mt=r(I,"A",{href:!0});var fi=i(mt);Vo=r(fi,"STRONG",{});var vl=i(Vo);pr=n(vl,"call"),vl.forEach(o),mr=n(fi,"()"),fi.forEach(o),hr=n(I," if "),Fo=r(I,"CODE",{});var wl=i(Fo);ur=n(wl,"images"),wl.forEach(o),fr=n(I," is not "),No=r(I,"CODE",{});var Ml=i(No);gr=n(Ml,"None"),Ml.forEach(o),_r=n(I,`. Please refer to the doctsring
of the above two methods for more information.`),I.forEach(o),Ps.forEach(o),Ve.forEach(o),Js=m(t),re=r(t,"H2",{class:!0});var Rs=i(re);ke=r(Rs,"A",{id:!0,class:!0,href:!0});var Tl=i(ke);Po=r(Tl,"SPAN",{});var Jl=i(Po);w(ht.$$.fragment,Jl),Jl.forEach(o),Tl.forEach(o),yr=m(Rs),Ro=r(Rs,"SPAN",{});var jl=i(Ro);br=n(jl,"GitModel"),jl.forEach(o),Rs.forEach(o),js=m(t),Z=r(t,"DIV",{class:!0});var q=i(Z);w(ut.$$.fragment,q),vr=m(q),Xo=r(q,"P",{});var Gl=i(Xo);wr=n(Gl,"The bare GIT Model transformer consisting of a CLIP image encoder and text decoder outputting raw hidden-states without any specific head on top."),Gl.forEach(o),Mr=m(q),ft=r(q,"P",{});var Xs=i(ft);Tr=n(Xs,"This model inherits from "),Dt=r(Xs,"A",{href:!0});var kl=i(Dt);Jr=n(kl,"PreTrainedModel"),kl.forEach(o),jr=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),Gr=m(q),gt=r(q,"P",{});var As=i(gt);kr=n(As,"This model is also a PyTorch "),_t=r(As,"A",{href:!0,rel:!0});var Il=i(_t);Ir=n(Il,"torch.nn.Module"),Il.forEach(o),$r=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),Cr=m(q),N=r(q,"DIV",{class:!0});var Fe=i(N);w(yt.$$.fragment,Fe),Zr=m(Fe),ie=r(Fe,"P",{});var lo=i(ie);Er=n(lo,"The "),Ot=r(lo,"A",{href:!0});var $l=i(Ot);Ur=n($l,"GitModel"),$l.forEach(o),Wr=n(lo," forward method, overrides the "),Ao=r(lo,"CODE",{});var Cl=i(Ao);xr=n(Cl,"__call__"),Cl.forEach(o),zr=n(lo," special method."),lo.forEach(o),Br=m(Fe),w(Ie.$$.fragment,Fe),Vr=m(Fe),w($e.$$.fragment,Fe),Fe.forEach(o),q.forEach(o),Gs=m(t),le=r(t,"H2",{class:!0});var qs=i(le);Ce=r(qs,"A",{id:!0,class:!0,href:!0});var Zl=i(Ce);qo=r(Zl,"SPAN",{});var El=i(qo);w(bt.$$.fragment,El),El.forEach(o),Zl.forEach(o),Fr=m(qs),Lo=r(qs,"SPAN",{});var Ul=i(Lo);Nr=n(Ul,"GitForCausalLM"),Ul.forEach(o),qs.forEach(o),ks=m(t),E=r(t,"DIV",{class:!0});var L=i(E);w(vt.$$.fragment,L),Pr=m(L),wt=r(L,"P",{});var Ls=i(wt);Rr=n(Ls,"GIT Model with a "),So=r(Ls,"CODE",{});var Wl=i(So);Xr=n(Wl,"language modeling"),Wl.forEach(o),Ar=n(Ls," head on top for autoregressive language modeling."),Ls.forEach(o),qr=m(L),Mt=r(L,"P",{});var Ss=i(Mt);Lr=n(Ss,"This model inherits from "),Kt=r(Ss,"A",{href:!0});var xl=i(Kt);Sr=n(xl,"PreTrainedModel"),xl.forEach(o),Yr=n(Ss,`. 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.)`),Ss.forEach(o),Qr=m(L),Tt=r(L,"P",{});var Ys=i(Tt);Hr=n(Ys,"This model is also a PyTorch "),Jt=r(Ys,"A",{href:!0,rel:!0});var zl=i(Jt);Dr=n(zl,"torch.nn.Module"),zl.forEach(o),Or=n(Ys,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ys.forEach(o),Kr=m(L),$=r(L,"DIV",{class:!0});var x=i($);w(jt.$$.fragment,x),ei=m(x),de=r(x,"P",{});var co=i(de);ti=n(co,"The "),eo=r(co,"A",{href:!0});var Bl=i(eo);oi=n(Bl,"GitForCausalLM"),Bl.forEach(o),si=n(co," forward method, overrides the "),Yo=r(co,"CODE",{});var Vl=i(Yo);ni=n(Vl,"__call__"),Vl.forEach(o),ai=n(co," special method."),co.forEach(o),ri=m(x),w(Ze.$$.fragment,x),ii=m(x),Qo=r(x,"P",{});var Fl=i(Qo);li=n(Fl,"Examples:"),Fl.forEach(o),di=m(x),w(Ee.$$.fragment,x),ci=m(x),w(Ue.$$.fragment,x),pi=m(x),w(We.$$.fragment,x),x.forEach(o),L.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(sd)),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(me,"id","overview"),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","#overview"),d(Y,"class","relative group"),d(Pe,"href","https://arxiv.org/abs/2205.14100"),d(Pe,"rel","nofollow"),d(Zt,"href","clip"),d(xt,"href","/docs/transformers/v4.32.0/en/model_doc/git#transformers.GitProcessor"),Al(ue.src,_i="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/git_architecture.jpg")||d(ue,"src",_i),d(ue,"alt","drawing"),d(ue,"width","600"),d(Xe,"href","https://arxiv.org/abs/2205.14100"),d(Xe,"target","_blank"),d(Ae,"href","https://huggingface.co/nielsr"),d(Ae,"rel","nofollow"),d(qe,"href","https://github.com/microsoft/GenerativeImage2Text"),d(qe,"rel","nofollow"),d(ge,"id","resources"),d(ge,"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(ge,"href","#resources"),d(H,"class","relative group"),d(Ye,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/GIT"),d(Ye,"rel","nofollow"),d(Vt,"href","../tasks/language_modeling"),d(ye,"id","transformers.GitVisionConfig"),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","#transformers.GitVisionConfig"),d(D,"class","relative group"),d(Nt,"href","/docs/transformers/v4.32.0/en/model_doc/git#transformers.GitVisionModel"),d(De,"href","https://huggingface.co/microsoft/git-base"),d(De,"rel","nofollow"),d(Pt,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Rt,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),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(ve,"id","transformers.GitVisionModel"),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.GitVisionModel"),d(ee,"class","relative group"),d(Xt,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),d(ot,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(ot,"rel","nofollow"),d(At,"href","/docs/transformers/v4.32.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(Te,"id","transformers.GitConfig"),d(Te,"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(Te,"href","#transformers.GitConfig"),d(oe,"class","relative group"),d(qt,"href","/docs/transformers/v4.32.0/en/model_doc/git#transformers.GitModel"),d(rt,"href","https://huggingface.co/microsoft/git-base"),d(rt,"rel","nofollow"),d(Lt,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(St,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),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(je,"id","transformers.GitProcessor"),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.GitProcessor"),d(ae,"class","relative group"),d(Yt,"href","/docs/transformers/v4.32.0/en/model_doc/git#transformers.GitProcessor"),d(Qt,"href","/docs/transformers/v4.32.0/en/model_doc/clip#transformers.CLIPImageProcessor"),d(Ht,"href","/docs/transformers/v4.32.0/en/model_doc/bert#transformers.BertTokenizerFast"),d(dt,"href","/docs/transformers/v4.32.0/en/model_doc/git#transformers.GitProcessor.__call__"),d(pt,"href","/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__"),d(mt,"href","/docs/transformers/v4.32.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__call__"),d(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(ke,"id","transformers.GitModel"),d(ke,"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(ke,"href","#transformers.GitModel"),d(re,"class","relative group"),d(Dt,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),d(_t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(_t,"rel","nofollow"),d(Ot,"href","/docs/transformers/v4.32.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(Ce,"id","transformers.GitForCausalLM"),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.GitForCausalLM"),d(le,"class","relative group"),d(Kt,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),d(Jt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Jt,"rel","nofollow"),d(eo,"href","/docs/transformers/v4.32.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(E,"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(_,U),e(U,Qs),g(t,ss,u),g(t,Y,u),e(Y,me),e(me,po),M(Ne,po,null),e(Y,Hs),e(Y,mo),e(mo,Ds),g(t,ns,u),g(t,R,u),e(R,Os),e(R,Pe),e(Pe,Ks),e(R,en),e(R,Zt),e(Zt,tn),e(R,on),g(t,as,u),g(t,Et,u),e(Et,sn),g(t,rs,u),g(t,Ut,u),e(Ut,ho),e(ho,nn),g(t,is,u),g(t,Wt,u),e(Wt,an),g(t,ls,u),g(t,he,u),e(he,Re),e(Re,rn),e(Re,uo),e(uo,ln),e(Re,dn),e(he,cn),e(he,Q),e(Q,pn),e(Q,xt),e(xt,mn),e(Q,hn),e(Q,fo),e(fo,un),e(Q,fn),g(t,ds,u),g(t,ue,u),g(t,cs,u),g(t,fe,u),e(fe,gn),e(fe,Xe),e(Xe,_n),e(fe,yn),g(t,ps,u),g(t,X,u),e(X,bn),e(X,Ae),e(Ae,vn),e(X,wn),e(X,qe),e(qe,Mn),e(X,Tn),g(t,ms,u),g(t,H,u),e(H,ge),e(ge,go),M(Le,go,null),e(H,Jn),e(H,_o),e(_o,jn),g(t,hs,u),g(t,zt,u),e(zt,Gn),g(t,us,u),g(t,_e,u),e(_e,Se),e(Se,kn),e(Se,Ye),e(Ye,In),e(Se,$n),e(_e,Cn),e(_e,Bt),e(Bt,Zn),e(Bt,Vt),e(Vt,En),g(t,fs,u),g(t,Ft,u),e(Ft,Un),g(t,gs,u),g(t,D,u),e(D,ye),e(ye,yo),M(Qe,yo,null),e(D,Wn),e(D,bo),e(bo,xn),g(t,_s,u),g(t,z,u),M(He,z,null),e(z,zn),e(z,O),e(O,Bn),e(O,Nt),e(Nt,Vn),e(O,Fn),e(O,De),e(De,Nn),e(O,Pn),e(z,Rn),e(z,K),e(K,Xn),e(K,Pt),e(Pt,An),e(K,qn),e(K,Rt),e(Rt,Ln),e(K,Sn),e(z,Yn),M(be,z,null),g(t,ys,u),g(t,ee,u),e(ee,ve),e(ve,vo),M(Oe,vo,null),e(ee,Qn),e(ee,wo),e(wo,Hn),g(t,bs,u),g(t,C,u),M(Ke,C,null),e(C,Dn),e(C,Mo),e(Mo,On),e(C,Kn),e(C,et),e(et,ea),e(et,Xt),e(Xt,ta),e(et,oa),e(C,sa),e(C,tt),e(tt,na),e(tt,ot),e(ot,aa),e(tt,ra),e(C,ia),e(C,F),M(st,F,null),e(F,la),e(F,te),e(te,da),e(te,At),e(At,ca),e(te,pa),e(te,To),e(To,ma),e(te,ha),e(F,ua),M(we,F,null),e(F,fa),M(Me,F,null),g(t,vs,u),g(t,oe,u),e(oe,Te),e(Te,Jo),M(nt,Jo,null),e(oe,ga),e(oe,jo),e(jo,_a),g(t,ws,u),g(t,B,u),M(at,B,null),e(B,ya),e(B,se),e(se,ba),e(se,qt),e(qt,va),e(se,wa),e(se,rt),e(rt,Ma),e(se,Ta),e(B,Ja),e(B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gs,u),g(t,le,u),e(le,Ce),e(Ce,qo),M(bt,qo,null),e(le,Fr),e(le,Lo),e(Lo,Nr),g(t,ks,u),g(t,E,u),M(vt,E,null),e(E,Pr),e(E,wt),e(wt,Rr),e(wt,So),e(So,Xr),e(wt,Ar),e(E,qr),e(E,Mt),e(Mt,Lr),e(Mt,Kt),e(Kt,Sr),e(Mt,Yr),e(E,Qr),e(E,Tt),e(Tt,Hr),e(Tt,Jt),e(Jt,Dr),e(Tt,Or),e(E,Kr),e(E,$),M(jt,$,null),e($,ei),e($,de),e(de,ti),e(de,eo),e(eo,oi),e(de,si),e(de,Yo),e(Yo,ni),e(de,ai),e($,ri),M(Ze,$,null),e($,ii),e($,Qo),e(Qo,li),e($,di),M(Ee,$,null),e($,ci),M(Ue,$,null),e($,pi),M(We,$,null),Is=!0},p(t,[u]){const Gt={};u&2&&(Gt.$$scope={dirty:u,ctx:t}),be.$set(Gt);const Ho={};u&2&&(Ho.$$scope={dirty:u,ctx:t}),we.$set(Ho);const Do={};u&2&&(Do.$$scope={dirty:u,ctx:t}),Me.$set(Do);const Oo={};u&2&&(Oo.$$scope={dirty:u,ctx:t}),Je.$set(Oo);const kt={};u&2&&(kt.$$scope={dirty:u,ctx:t}),Ie.$set(kt);const Ko={};u&2&&(Ko.$$scope={dirty:u,ctx:t}),$e.$set(Ko);const es={};u&2&&(es.$$scope={dirty:u,ctx:t}),Ze.$set(es);const ts={};u&2&&(ts.$$scope={dirty:u,ctx:t}),Ee.$set(ts);const ce={};u&2&&(ce.$$scope={dirty:u,ctx:t}),Ue.$set(ce);const os={};u&2&&(os.$$scope={dirty:u,ctx:t}),We.$set(os)},i(t){Is||(T(l.$$.fragment,t),T(Ne.$$.fragment,t),T(Le.$$.fragment,t),T(Qe.$$.fragment,t),T(He.$$.fragment,t),T(be.$$.fragment,t),T(Oe.$$.fragment,t),T(Ke.$$.fragment,t),T(st.$$.fragment,t),T(we.$$.fragment,t),T(Me.$$.fragment,t),T(nt.$$.fragment,t),T(at.$$.fragment,t),T(Je.$$.fragment,t),T(it.$$.fragment,t),T(lt.$$.fragment,t),T(ct.$$.fragment,t),T(ht.$$.fragment,t),T(ut.$$.fragment,t),T(yt.$$.fragment,t),T(Ie.$$.fragment,t),T($e.$$.fragment,t),T(bt.$$.fragment,t),T(vt.$$.fragment,t),T(jt.$$.fragment,t),T(Ze.$$.fragment,t),T(Ee.$$.fragment,t),T(Ue.$$.fragment,t),T(We.$$.fragment,t),Is=!0)},o(t){J(l.$$.fragment,t),J(Ne.$$.fragment,t),J(Le.$$.fragment,t),J(Qe.$$.fragment,t),J(He.$$.fragment,t),J(be.$$.fragment,t),J(Oe.$$.fragment,t),J(Ke.$$.fragment,t),J(st.$$.fragment,t),J(we.$$.fragment,t),J(Me.$$.fragment,t),J(nt.$$.fragment,t),J(at.$$.fragment,t),J(Je.$$.fragment,t),J(it.$$.fragment,t),J(lt.$$.fragment,t),J(ct.$$.fragment,t),J(ht.$$.fragment,t),J(ut.$$.fragment,t),J(yt.$$.fragment,t),J(Ie.$$.fragment,t),J($e.$$.fragment,t),J(bt.$$.fragment,t),J(vt.$$.fragment,t),J(jt.$$.fragment,t),J(Ze.$$.fragment,t),J(Ee.$$.fragment,t),J(Ue.$$.fragment,t),J(We.$$.fragment,t),Is=!1},d(t){o(c),t&&o(b),t&&o(_),j(l),t&&o(ss),t&&o(Y),j(Ne),t&&o(ns),t&&o(R),t&&o(as),t&&o(Et),t&&o(rs),t&&o(Ut),t&&o(is),t&&o(Wt),t&&o(ls),t&&o(he),t&&o(ds),t&&o(ue),t&&o(cs),t&&o(fe),t&&o(ps),t&&o(X),t&&o(ms),t&&o(H),j(Le),t&&o(hs),t&&o(zt),t&&o(us),t&&o(_e),t&&o(fs),t&&o(Ft),t&&o(gs),t&&o(D),j(Qe),t&&o(_s),t&&o(z),j(He),j(be),t&&o(ys),t&&o(ee),j(Oe),t&&o(bs),t&&o(C),j(Ke),j(st),j(we),j(Me),t&&o(vs),t&&o(oe),j(nt),t&&o(ws),t&&o(B),j(at),j(Je),t&&o(Ms),t&&o(ae),j(it),t&&o(Ts),t&&o(V),j(lt),j(ct),t&&o(Js),t&&o(re),j(ht),t&&o(js),t&&o(Z),j(ut),j(yt),j(Ie),j($e),t&&o(Gs),t&&o(le),j(bt),t&&o(ks),t&&o(E),j(vt),j(jt),j(Ze),j(Ee),j(Ue),j(We)}}}const sd={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 nd(k){return ql(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pd extends Nl{constructor(c){super();Pl(this,c,nd,od,Rl,{})}}export{pd as default,sd as metadata};
