Buckets:
| import{s as Ft,o as At,n as Me}from"../chunks/scheduler.31fdf58d.js";import{S as Xt,i as zt,e as m,s as r,c as _,h as Wt,a as p,d as s,b as l,f as re,j as f,g as y,k as le,l as d,m as i,n as b,t as v,o as M,p as T}from"../chunks/index.2f76fdf0.js";import{T as mt}from"../chunks/Tip.8d349121.js";import{C as Nt}from"../chunks/CopyLLMTxtMenu.f658c69c.js";import{D as we}from"../chunks/Docstring.ea03692a.js";import{C as Ie}from"../chunks/CodeBlock.e52df5d6.js";import{E as qe}from"../chunks/ExampleCodeBlock.8394e99c.js";import{H as ve,E as Vt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.0d9e7a9c.js";function Bt(w){let o,g="Example:",c,n,u;return n=new Ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9mb3JtZXJDb25maWclMkMlMjBBdXRvZm9ybWVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwZGVmYXVsdCUyMEF1dG9mb3JtZXIlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEF1dG9mb3JtZXJDb25maWcoKSUwQSUwQSUyMyUyMFJhbmRvbWx5JTIwaW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBBdXRvZm9ybWVyTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoformerConfig, AutoformerModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a default Autoformer configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = AutoformerConfig() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Randomly initializing a model (with random weights) from the configuration</span> | |
| <span class="hljs-meta">>>> </span>model = AutoformerModel(configuration) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Accessing the model configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = model.config`,lang:"python",wrap:!1}}),{c(){o=m("p"),o.textContent=g,c=r(),_(n.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),f(o)!=="svelte-11lpom8"&&(o.textContent=g),c=l(t),y(n.$$.fragment,t)},m(t,h){i(t,o,h),i(t,c,h),b(n,t,h),u=!0},p:Me,i(t){u||(v(n.$$.fragment,t),u=!0)},o(t){M(n.$$.fragment,t),u=!1},d(t){t&&(s(o),s(c)),T(n,t)}}}function Rt(w){let o,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){o=m("p"),o.innerHTML=g},l(c){o=p(c,"P",{"data-svelte-h":!0}),f(o)!=="svelte-fincs2"&&(o.innerHTML=g)},m(c,n){i(c,o,n)},p:Me,d(c){c&&s(o)}}}function Gt(w){let o,g="Examples:",c,n,u;return n=new Ie({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGhmX2h1Yl9kb3dubG9hZCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9mb3JtZXJNb2RlbCUwQSUwQWZpbGUlMjAlM0QlMjBoZl9odWJfZG93bmxvYWQoJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZ0b3VyaXNtLW1vbnRobHktYmF0Y2glMjIlMkMlMjBmaWxlbmFtZSUzRCUyMnRyYWluLWJhdGNoLnB0JTIyJTJDJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUwQSklMEFiYXRjaCUyMCUzRCUyMHRvcmNoLmxvYWQoZmlsZSklMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9mb3JtZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyaHVnZ2luZ2ZhY2UlMkZhdXRvZm9ybWVyLXRvdXJpc20tbW9udGhseSUyMiklMEElMEElMjMlMjBkdXJpbmclMjB0cmFpbmluZyUyQyUyMG9uZSUyMHByb3ZpZGVzJTIwYm90aCUyMHBhc3QlMjBhbmQlMjBmdXR1cmUlMjB2YWx1ZXMlMEElMjMlMjBhcyUyMHdlbGwlMjBhcyUyMHBvc3NpYmxlJTIwYWRkaXRpb25hbCUyMGZlYXR1cmVzJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMHBhc3RfdmFsdWVzJTNEYmF0Y2glNUIlMjJwYXN0X3ZhbHVlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHBhc3RfdGltZV9mZWF0dXJlcyUzRGJhdGNoJTVCJTIycGFzdF90aW1lX2ZlYXR1cmVzJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwcGFzdF9vYnNlcnZlZF9tYXNrJTNEYmF0Y2glNUIlMjJwYXN0X29ic2VydmVkX21hc2slMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzdGF0aWNfY2F0ZWdvcmljYWxfZmVhdHVyZXMlM0RiYXRjaCU1QiUyMnN0YXRpY19jYXRlZ29yaWNhbF9mZWF0dXJlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGZ1dHVyZV92YWx1ZXMlM0RiYXRjaCU1QiUyMmZ1dHVyZV92YWx1ZXMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBmdXR1cmVfdGltZV9mZWF0dXJlcyUzRGJhdGNoJTVCJTIyZnV0dXJlX3RpbWVfZmVhdHVyZXMlMjIlNUQlMkMlMEEpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGUlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoformerModel | |
| <span class="hljs-meta">>>> </span>file = hf_hub_download( | |
| <span class="hljs-meta">... </span> repo_id=<span class="hljs-string">"hf-internal-testing/tourism-monthly-batch"</span>, filename=<span class="hljs-string">"train-batch.pt"</span>, repo_type=<span class="hljs-string">"dataset"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>batch = torch.load(file) | |
| <span class="hljs-meta">>>> </span>model = AutoformerModel.from_pretrained(<span class="hljs-string">"huggingface/autoformer-tourism-monthly"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># during training, one provides both past and future values</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># as well as possible additional features</span> | |
| <span class="hljs-meta">>>> </span>outputs = model( | |
| <span class="hljs-meta">... </span> past_values=batch[<span class="hljs-string">"past_values"</span>], | |
| <span class="hljs-meta">... </span> past_time_features=batch[<span class="hljs-string">"past_time_features"</span>], | |
| <span class="hljs-meta">... </span> past_observed_mask=batch[<span class="hljs-string">"past_observed_mask"</span>], | |
| <span class="hljs-meta">... </span> static_categorical_features=batch[<span class="hljs-string">"static_categorical_features"</span>], | |
| <span class="hljs-meta">... </span> future_values=batch[<span class="hljs-string">"future_values"</span>], | |
| <span class="hljs-meta">... </span> future_time_features=batch[<span class="hljs-string">"future_time_features"</span>], | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>last_hidden_state = outputs.last_hidden_state`,lang:"python",wrap:!1}}),{c(){o=m("p"),o.textContent=g,c=r(),_(n.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),f(o)!=="svelte-kvfsh7"&&(o.textContent=g),c=l(t),y(n.$$.fragment,t)},m(t,h){i(t,o,h),i(t,c,h),b(n,t,h),u=!0},p:Me,i(t){u||(v(n.$$.fragment,t),u=!0)},o(t){M(n.$$.fragment,t),u=!1},d(t){t&&(s(o),s(c)),T(n,t)}}}function Yt(w){let o,g=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){o=m("p"),o.innerHTML=g},l(c){o=p(c,"P",{"data-svelte-h":!0}),f(o)!=="svelte-fincs2"&&(o.innerHTML=g)},m(c,n){i(c,o,n)},p:Me,d(c){c&&s(o)}}}function qt(w){let o,g="Examples:",c,n,u;return n=new Ie({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGhmX2h1Yl9kb3dubG9hZCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9mb3JtZXJGb3JQcmVkaWN0aW9uJTBBJTBBZmlsZSUyMCUzRCUyMGhmX2h1Yl9kb3dubG9hZCglMEElMjAlMjAlMjAlMjByZXBvX2lkJTNEJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRnRvdXJpc20tbW9udGhseS1iYXRjaCUyMiUyQyUyMGZpbGVuYW1lJTNEJTIydHJhaW4tYmF0Y2gucHQlMjIlMkMlMjByZXBvX3R5cGUlM0QlMjJkYXRhc2V0JTIyJTBBKSUwQWJhdGNoJTIwJTNEJTIwdG9yY2gubG9hZChmaWxlKSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b2Zvcm1lckZvclByZWRpY3Rpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmh1Z2dpbmdmYWNlJTJGYXV0b2Zvcm1lci10b3VyaXNtLW1vbnRobHklMjIpJTBBJTBBJTIzJTIwZHVyaW5nJTIwdHJhaW5pbmclMkMlMjBvbmUlMjBwcm92aWRlcyUyMGJvdGglMjBwYXN0JTIwYW5kJTIwZnV0dXJlJTIwdmFsdWVzJTBBJTIzJTIwYXMlMjB3ZWxsJTIwYXMlMjBwb3NzaWJsZSUyMGFkZGl0aW9uYWwlMjBmZWF0dXJlcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCglMEElMjAlMjAlMjAlMjBwYXN0X3ZhbHVlcyUzRGJhdGNoJTVCJTIycGFzdF92YWx1ZXMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBwYXN0X3RpbWVfZmVhdHVyZXMlM0RiYXRjaCU1QiUyMnBhc3RfdGltZV9mZWF0dXJlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHBhc3Rfb2JzZXJ2ZWRfbWFzayUzRGJhdGNoJTVCJTIycGFzdF9vYnNlcnZlZF9tYXNrJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc3RhdGljX2NhdGVnb3JpY2FsX2ZlYXR1cmVzJTNEYmF0Y2glNUIlMjJzdGF0aWNfY2F0ZWdvcmljYWxfZmVhdHVyZXMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBmdXR1cmVfdmFsdWVzJTNEYmF0Y2glNUIlMjJmdXR1cmVfdmFsdWVzJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZnV0dXJlX3RpbWVfZmVhdHVyZXMlM0RiYXRjaCU1QiUyMmZ1dHVyZV90aW1lX2ZlYXR1cmVzJTIyJTVEJTJDJTBBKSUwQSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb3NzLmJhY2t3YXJkKCklMEElMEElMjMlMjBkdXJpbmclMjBpbmZlcmVuY2UlMkMlMjBvbmUlMjBvbmx5JTIwcHJvdmlkZXMlMjBwYXN0JTIwdmFsdWVzJTBBJTIzJTIwYXMlMjB3ZWxsJTIwYXMlMjBwb3NzaWJsZSUyMGFkZGl0aW9uYWwlMjBmZWF0dXJlcyUwQSUyMyUyMHRoZSUyMG1vZGVsJTIwYXV0b3JlZ3Jlc3NpdmVseSUyMGdlbmVyYXRlcyUyMGZ1dHVyZSUyMHZhbHVlcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjBwYXN0X3ZhbHVlcyUzRGJhdGNoJTVCJTIycGFzdF92YWx1ZXMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBwYXN0X3RpbWVfZmVhdHVyZXMlM0RiYXRjaCU1QiUyMnBhc3RfdGltZV9mZWF0dXJlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHBhc3Rfb2JzZXJ2ZWRfbWFzayUzRGJhdGNoJTVCJTIycGFzdF9vYnNlcnZlZF9tYXNrJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc3RhdGljX2NhdGVnb3JpY2FsX2ZlYXR1cmVzJTNEYmF0Y2glNUIlMjJzdGF0aWNfY2F0ZWdvcmljYWxfZmVhdHVyZXMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBmdXR1cmVfdGltZV9mZWF0dXJlcyUzRGJhdGNoJTVCJTIyZnV0dXJlX3RpbWVfZmVhdHVyZXMlMjIlNUQlMkMlMEEpJTBBJTBBbWVhbl9wcmVkaWN0aW9uJTIwJTNEJTIwb3V0cHV0cy5zZXF1ZW5jZXMubWVhbihkaW0lM0QxKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoformerForPrediction | |
| <span class="hljs-meta">>>> </span>file = hf_hub_download( | |
| <span class="hljs-meta">... </span> repo_id=<span class="hljs-string">"hf-internal-testing/tourism-monthly-batch"</span>, filename=<span class="hljs-string">"train-batch.pt"</span>, repo_type=<span class="hljs-string">"dataset"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>batch = torch.load(file) | |
| <span class="hljs-meta">>>> </span>model = AutoformerForPrediction.from_pretrained(<span class="hljs-string">"huggingface/autoformer-tourism-monthly"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># during training, one provides both past and future values</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># as well as possible additional features</span> | |
| <span class="hljs-meta">>>> </span>outputs = model( | |
| <span class="hljs-meta">... </span> past_values=batch[<span class="hljs-string">"past_values"</span>], | |
| <span class="hljs-meta">... </span> past_time_features=batch[<span class="hljs-string">"past_time_features"</span>], | |
| <span class="hljs-meta">... </span> past_observed_mask=batch[<span class="hljs-string">"past_observed_mask"</span>], | |
| <span class="hljs-meta">... </span> static_categorical_features=batch[<span class="hljs-string">"static_categorical_features"</span>], | |
| <span class="hljs-meta">... </span> future_values=batch[<span class="hljs-string">"future_values"</span>], | |
| <span class="hljs-meta">... </span> future_time_features=batch[<span class="hljs-string">"future_time_features"</span>], | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss | |
| <span class="hljs-meta">>>> </span>loss.backward() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># during inference, one only provides past values</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># as well as possible additional features</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># the model autoregressively generates future values</span> | |
| <span class="hljs-meta">>>> </span>outputs = model.generate( | |
| <span class="hljs-meta">... </span> past_values=batch[<span class="hljs-string">"past_values"</span>], | |
| <span class="hljs-meta">... </span> past_time_features=batch[<span class="hljs-string">"past_time_features"</span>], | |
| <span class="hljs-meta">... </span> past_observed_mask=batch[<span class="hljs-string">"past_observed_mask"</span>], | |
| <span class="hljs-meta">... </span> static_categorical_features=batch[<span class="hljs-string">"static_categorical_features"</span>], | |
| <span class="hljs-meta">... </span> future_time_features=batch[<span class="hljs-string">"future_time_features"</span>], | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>mean_prediction = outputs.sequences.mean(dim=<span class="hljs-number">1</span>)`,lang:"python",wrap:!1}}),{c(){o=m("p"),o.textContent=g,c=r(),_(n.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),f(o)!=="svelte-kvfsh7"&&(o.textContent=g),c=l(t),y(n.$$.fragment,t)},m(t,h){i(t,o,h),i(t,c,h),b(n,t,h),u=!0},p:Me,i(t){u||(v(n.$$.fragment,t),u=!0)},o(t){M(n.$$.fragment,t),u=!1},d(t){t&&(s(o),s(c)),T(n,t)}}}function It(w){let o,g="is equal to 1), initialize the model and call as shown below:",c,n,u;return n=new Ie({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGhmX2h1Yl9kb3dubG9hZCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9mb3JtZXJDb25maWclMkMlMjBBdXRvZm9ybWVyRm9yUHJlZGljdGlvbiUwQSUwQWZpbGUlMjAlM0QlMjBoZl9odWJfZG93bmxvYWQoJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZ0b3VyaXNtLW1vbnRobHktYmF0Y2glMjIlMkMlMjBmaWxlbmFtZSUzRCUyMnRyYWluLWJhdGNoLnB0JTIyJTJDJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUwQSklMEFiYXRjaCUyMCUzRCUyMHRvcmNoLmxvYWQoZmlsZSklMEElMEElMjMlMjBjaGVjayUyMG51bWJlciUyMG9mJTIwc3RhdGljJTIwcmVhbCUyMGZlYXR1cmVzJTBBbnVtX3N0YXRpY19yZWFsX2ZlYXR1cmVzJTIwJTNEJTIwYmF0Y2glNUIlMjJzdGF0aWNfcmVhbF9mZWF0dXJlcyUyMiU1RC5zaGFwZSU1Qi0xJTVEJTBBJTBBJTIzJTIwbG9hZCUyMGNvbmZpZ3VyYXRpb24lMjBvZiUyMHByZXRyYWluZWQlMjBtb2RlbCUyMGFuZCUyMG92ZXJyaWRlJTIwbnVtX3N0YXRpY19yZWFsX2ZlYXR1cmVzJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEF1dG9mb3JtZXJDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmh1Z2dpbmdmYWNlJTJGYXV0b2Zvcm1lci10b3VyaXNtLW1vbnRobHklMjIlMkMlMEElMjAlMjAlMjAlMjBudW1fc3RhdGljX3JlYWxfZmVhdHVyZXMlM0RudW1fc3RhdGljX3JlYWxfZmVhdHVyZXMlMkMlMEEpJTBBJTIzJTIwd2UlMjBhbHNvJTIwbmVlZCUyMHRvJTIwdXBkYXRlJTIwZmVhdHVyZV9zaXplJTIwYXMlMjBpdCUyMGlzJTIwbm90JTIwcmVjYWxjdWxhdGVkJTBBY29uZmlndXJhdGlvbi5mZWF0dXJlX3NpemUlMjAlMkIlM0QlMjBudW1fc3RhdGljX3JlYWxfZmVhdHVyZXMlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9mb3JtZXJGb3JQcmVkaWN0aW9uKGNvbmZpZ3VyYXRpb24pJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMHBhc3RfdmFsdWVzJTNEYmF0Y2glNUIlMjJwYXN0X3ZhbHVlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHBhc3RfdGltZV9mZWF0dXJlcyUzRGJhdGNoJTVCJTIycGFzdF90aW1lX2ZlYXR1cmVzJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwcGFzdF9vYnNlcnZlZF9tYXNrJTNEYmF0Y2glNUIlMjJwYXN0X29ic2VydmVkX21hc2slMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzdGF0aWNfY2F0ZWdvcmljYWxfZmVhdHVyZXMlM0RiYXRjaCU1QiUyMnN0YXRpY19jYXRlZ29yaWNhbF9mZWF0dXJlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHN0YXRpY19yZWFsX2ZlYXR1cmVzJTNEYmF0Y2glNUIlMjJzdGF0aWNfcmVhbF9mZWF0dXJlcyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGZ1dHVyZV92YWx1ZXMlM0RiYXRjaCU1QiUyMmZ1dHVyZV92YWx1ZXMlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBmdXR1cmVfdGltZV9mZWF0dXJlcyUzRGJhdGNoJTVCJTIyZnV0dXJlX3RpbWVfZmVhdHVyZXMlMjIlNUQlMkMlMEEp",highlighted:`<span class="hljs-meta prompt_">>>></span> <span class="language-python"><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> hf_hub_download</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python"><span class="hljs-keyword">import</span> torch</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python"><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoformerConfig, AutoformerForPrediction</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">file = hf_hub_download(</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> repo_id=<span class="hljs-string">"hf-internal-testing/tourism-monthly-batch"</span>, filename=<span class="hljs-string">"train-batch.pt"</span>, repo_type=<span class="hljs-string">"dataset"</span></span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python">)</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">batch = torch.load(file)</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python"><span class="hljs-comment"># check number of static real features</span></span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">num_static_real_features = batch[<span class="hljs-string">"static_real_features"</span>].shape[-<span class="hljs-number">1</span>]</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python"><span class="hljs-comment"># load configuration of pretrained model and override num_static_real_features</span></span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">configuration = AutoformerConfig.from_pretrained(</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> <span class="hljs-string">"huggingface/autoformer-tourism-monthly"</span>,</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> num_static_real_features=num_static_real_features,</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python">)</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python"><span class="hljs-comment"># we also need to update feature_size as it is not recalculated</span></span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">configuration.feature_size += num_static_real_features</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">model = AutoformerForPrediction(configuration)</span> | |
| <span class="hljs-meta prompt_">>>></span> <span class="language-python">outputs = model(</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> past_values=batch[<span class="hljs-string">"past_values"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> past_time_features=batch[<span class="hljs-string">"past_time_features"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> past_observed_mask=batch[<span class="hljs-string">"past_observed_mask"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> static_categorical_features=batch[<span class="hljs-string">"static_categorical_features"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> static_real_features=batch[<span class="hljs-string">"static_real_features"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> future_values=batch[<span class="hljs-string">"future_values"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python"> future_time_features=batch[<span class="hljs-string">"future_time_features"</span>],</span> | |
| <span class="hljs-meta prompt_">...</span> <span class="language-python">)</span>`,lang:"",wrap:!1}}),{c(){o=m("p"),o.textContent=g,c=r(),_(n.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),f(o)!=="svelte-1hzwtfu"&&(o.textContent=g),c=l(t),y(n.$$.fragment,t)},m(t,h){i(t,o,h),i(t,c,h),b(n,t,h),u=!0},p:Me,i(t){u||(v(n.$$.fragment,t),u=!0)},o(t){M(n.$$.fragment,t),u=!1},d(t){t&&(s(o),s(c)),T(n,t)}}}function Et(w){let o,g=`The AutoformerForPrediction can also use static_real_features. To do so, set num_static_real_features in | |
| AutoformerConfig based on number of such features in the dataset (in case of tourism_monthly dataset it`,c,n,u;return n=new qe({props:{anchor:"transformers.AutoformerForPrediction.forward.example-2",$$slots:{default:[It]},$$scope:{ctx:w}}}),{c(){o=m("p"),o.textContent=g,c=r(),_(n.$$.fragment)},l(t){o=p(t,"P",{"data-svelte-h":!0}),f(o)!=="svelte-14i5hlv"&&(o.textContent=g),c=l(t),y(n.$$.fragment,t)},m(t,h){i(t,o,h),i(t,c,h),b(n,t,h),u=!0},p(t,h){const X={};h&2&&(X.$$scope={dirty:h,ctx:t}),n.$set(X)},i(t){u||(v(n.$$.fragment,t),u=!0)},o(t){M(n.$$.fragment,t),u=!1},d(t){t&&(s(o),s(c)),T(n,t)}}}function Ht(w){let o,g,c,n,u,t="<em>This model was published in HF papers on 2021-06-24 and contributed to Hugging Face Transformers on 2023-05-30.</em>",h,X,je,G,Ce,Y,Je,q,pt='The Autoformer model was proposed in <a href="https://huggingface.co/papers/2106.13008" rel="nofollow">Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting</a> by Haixu Wu, Jiehui Xu, Jianmin Wang, Mingsheng Long.',xe,I,ut="This model augments the Transformer as a deep decomposition architecture, which can progressively decompose the trend and seasonal components during the forecasting process.",Ue,E,ht="The abstract from the paper is the following:",$e,H,ft="<em>Extending the forecasting time is a critical demand for real applications, such as extreme weather early warning and long-term energy consumption planning. This paper studies the long-term forecasting problem of time series. Prior Transformer-based models adopt various self-attention mechanisms to discover the long-range dependencies. However, intricate temporal patterns of the long-term future prohibit the model from finding reliable dependencies. Also, Transformers have to adopt the sparse versions of point-wise self-attentions for long series efficiency, resulting in the information utilization bottleneck. Going beyond Transformers, we design Autoformer as a novel decomposition architecture with an Auto-Correlation mechanism. We break with the pre-processing convention of series decomposition and renovate it as a basic inner block of deep models. This design empowers Autoformer with progressive decomposition capacities for complex time series. Further, inspired by the stochastic process theory, we design the Auto-Correlation mechanism based on the series periodicity, which conducts the dependencies discovery and representation aggregation at the sub-series level. Auto-Correlation outperforms self-attention in both efficiency and accuracy. In long-term forecasting, Autoformer yields state-of-the-art accuracy, with a 38% relative improvement on six benchmarks, covering five practical applications: energy, traffic, economics, weather and disease.</em>",ke,S,gt=`This model was contributed by <a href="https://huggingface.co/elisim" rel="nofollow">elisim</a> and <a href="https://huggingface.co/kashif" rel="nofollow">kashif</a>. | |
| The original code can be found <a href="https://github.com/thuml/Autoformer" rel="nofollow">here</a>.`,Ze,P,Fe,Q,_t="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Ae,L,yt='<li>Check out the Autoformer blog-post in HuggingFace blog: <a href="https://huggingface.co/blog/autoformer" rel="nofollow">Yes, Transformers are Effective for Time Series Forecasting (+ Autoformer)</a></li>',Xe,D,ze,$,O,Ee,ie,bt=`This is the configuration class to store the configuration of a AutoformerModel. It is used to instantiate a Autoformer | |
| 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 <a href="https://huggingface.co/huggingface/autoformer-tourism-monthly" rel="nofollow">huggingface/autoformer-tourism-monthly</a>`,He,ce,vt=`Configuration objects inherit from <a href="/docs/transformers/pr_43838/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> and can be used to control the model outputs. Read the | |
| documentation from <a href="/docs/transformers/pr_43838/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> for more information.`,Se,z,We,K,Ne,C,ee,Pe,de,Mt="The bare Autoformer Model outputting raw hidden-states without any specific head on top.",Qe,me,Tt=`This model inherits from <a href="/docs/transformers/pr_43838/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Le,pe,wt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,De,U,te,Oe,ue,jt='The <a href="/docs/transformers/pr_43838/en/model_doc/autoformer#transformers.AutoformerModel">AutoformerModel</a> forward method, overrides the <code>__call__</code> special method.',Ke,W,et,he,Ct=`<li><p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the decoder of the model.</p> <p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p></li> <li><p><strong>trend</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Trend tensor for each time series.</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_43838/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>decoder_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>) — 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 decoder at the output of each layer plus the initial embedding outputs.</p></li> <li><p><strong>decoder_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>) — 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 of the decoder, after the attention softmax, used to compute the weighted average in the | |
| self-attention heads.</p></li> <li><p><strong>cross_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>) — 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 of the decoder’s cross-attention layer, after the attention softmax, used to compute the | |
| weighted average in the cross-attention heads.</p></li> <li><p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p></li> <li><p><strong>encoder_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>) — 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 encoder at the output of each layer plus the initial embedding outputs.</p></li> <li><p><strong>encoder_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>) — 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 of the encoder, after the attention softmax, used to compute the weighted average in the | |
| self-attention heads.</p></li> <li><p><strong>loc</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size,)</code> or <code>(batch_size, input_size)</code>, <em>optional</em>) — Shift values of each time series’ context window which is used to give the model inputs of the same | |
| magnitude and then used to shift back to the original magnitude.</p></li> <li><p><strong>scale</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size,)</code> or <code>(batch_size, input_size)</code>, <em>optional</em>) — Scaling values of each time series’ context window which is used to give the model inputs of the same | |
| magnitude and then used to rescale back to the original magnitude. | |
| static_features: (<code>torch.FloatTensor</code> of shape <code>(batch_size, feature size)</code>, <em>optional</em>): | |
| Static features of each time series’ in a batch which are copied to the covariates at inference time.</p></li> <li><p><strong>static_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, feature size)</code>, <em>optional</em>) — Static features of each time series’ in a batch which are copied to the covariates at inference time.</p></li>`,tt,N,Ve,oe,Be,J,ae,ot,fe,Jt="The Autoformer Model with a distribution head on top for time-series forecasting.",at,ge,xt=`This model inherits from <a href="/docs/transformers/pr_43838/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,st,_e,Ut=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,nt,j,se,rt,ye,$t='The <a href="/docs/transformers/pr_43838/en/model_doc/autoformer#transformers.AutoformerForPrediction">AutoformerForPrediction</a> forward method, overrides the <code>__call__</code> special method.',lt,V,it,be,kt=`<li><p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when a <code>future_values</code> is provided) — Distributional loss.</p></li> <li><p><strong>params</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_samples, num_params)</code>) — Parameters of the chosen distribution.</p></li> <li><p><strong>past_key_values</strong> (<code>EncoderDecoderCache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_43838/en/internal/generation_utils#transformers.EncoderDecoderCache">EncoderDecoderCache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>decoder_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>) — 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 decoder at the output of each layer plus the initial embedding outputs.</p></li> <li><p><strong>decoder_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>) — 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 of the decoder, after the attention softmax, used to compute the weighted average in the | |
| self-attention heads.</p></li> <li><p><strong>cross_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>) — 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 of the decoder’s cross-attention layer, after the attention softmax, used to compute the | |
| weighted average in the cross-attention heads.</p></li> <li><p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p></li> <li><p><strong>encoder_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>) — 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 encoder at the output of each layer plus the initial embedding outputs.</p></li> <li><p><strong>encoder_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>) — 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 of the encoder, after the attention softmax, used to compute the weighted average in the | |
| self-attention heads.</p></li> <li><p><strong>loc</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size,)</code> or <code>(batch_size, input_size)</code>, <em>optional</em>) — Shift values of each time series’ context window which is used to give the model inputs of the same | |
| magnitude and then used to shift back to the original magnitude.</p></li> <li><p><strong>scale</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size,)</code> or <code>(batch_size, input_size)</code>, <em>optional</em>) — Scaling values of each time series’ context window which is used to give the model inputs of the same | |
| magnitude and then used to rescale back to the original magnitude.</p></li> <li><p><strong>static_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, feature size)</code>, <em>optional</em>) — Static features of each time series’ in a batch which are copied to the covariates at inference time.</p></li>`,ct,B,dt,R,Re,ne,Ge,Te,Ye;return X=new Nt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),G=new ve({props:{title:"Autoformer",local:"autoformer",headingTag:"h1"}}),Y=new ve({props:{title:"Overview",local:"overview",headingTag:"h2"}}),P=new ve({props:{title:"Resources",local:"resources",headingTag:"h2"}}),D=new ve({props:{title:"AutoformerConfig",local:"transformers.AutoformerConfig",headingTag:"h2"}}),O=new we({props:{name:"class transformers.AutoformerConfig",anchor:"transformers.AutoformerConfig",parameters:[{name:"transformers_version",val:": str | None = None"},{name:"architectures",val:": list[str] | None = None"},{name:"output_hidden_states",val:": bool | None = False"},{name:"return_dict",val:": bool | None = True"},{name:"dtype",val:": typing.Union[str, ForwardRef('torch.dtype'), NoneType] = None"},{name:"chunk_size_feed_forward",val:": int = 0"},{name:"id2label",val:": dict[int, str] | dict[str, str] | None = None"},{name:"label2id",val:": dict[str, int] | dict[str, str] | None = None"},{name:"problem_type",val:": typing.Optional[typing.Literal['regression', 'single_label_classification', 'multi_label_classification']] = None"},{name:"is_encoder_decoder",val:": bool = True"},{name:"prediction_length",val:": int | None = None"},{name:"context_length",val:": int | None = None"},{name:"distribution_output",val:": str = 'student_t'"},{name:"loss",val:": str = 'nll'"},{name:"input_size",val:": int = 1"},{name:"lags_sequence",val:": list[int] | tuple[int, ...] = (1, 2, 3, 4, 5, 6, 7)"},{name:"scaling",val:": bool | str = True"},{name:"num_time_features",val:": int = 0"},{name:"num_dynamic_real_features",val:": int = 0"},{name:"num_static_categorical_features",val:": int = 0"},{name:"num_static_real_features",val:": int = 0"},{name:"cardinality",val:": list[int] | None = None"},{name:"embedding_dimension",val:": list[int] | None = None"},{name:"d_model",val:": int = 64"},{name:"encoder_attention_heads",val:": int = 2"},{name:"decoder_attention_heads",val:": int = 2"},{name:"encoder_layers",val:": int = 2"},{name:"decoder_layers",val:": int = 2"},{name:"encoder_ffn_dim",val:": int = 32"},{name:"decoder_ffn_dim",val:": int = 32"},{name:"activation_function",val:": str = 'gelu'"},{name:"dropout",val:": float | int = 0.1"},{name:"encoder_layerdrop",val:": float | int = 0.1"},{name:"decoder_layerdrop",val:": float | int = 0.1"},{name:"attention_dropout",val:": float | int = 0.1"},{name:"activation_dropout",val:": float | int = 0.1"},{name:"num_parallel_samples",val:": int = 100"},{name:"init_std",val:": float = 0.02"},{name:"use_cache",val:": bool = True"},{name:"label_length",val:": int = 10"},{name:"moving_average",val:": int = 25"},{name:"autocorrelation_factor",val:": int = 3"}],parametersDescription:[{anchor:"transformers.AutoformerConfig.is_encoder_decoder",description:`<strong>is_encoder_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether the model is used as an encoder/decoder or not.`,name:"is_encoder_decoder"},{anchor:"transformers.AutoformerConfig.prediction_length",description:`<strong>prediction_length</strong> (<code>int</code>, <em>optional</em>) — | |
| The prediction length for the decoder. In other words, the prediction horizon of the model.`,name:"prediction_length"},{anchor:"transformers.AutoformerConfig.context_length",description:`<strong>context_length</strong> (<code>int</code>, <em>optional</em>, defaults to <code>prediction_length</code>) — | |
| The context length for the encoder. If unset, the context length will be the same as the | |
| <code>prediction_length</code>.`,name:"context_length"},{anchor:"transformers.AutoformerConfig.distribution_output",description:`<strong>distribution_output</strong> (<code>string</code>, <em>optional</em>, defaults to <code>"student_t"</code>) — | |
| The distribution emission head for the model. Could be either “student_t”, “normal” or “negative_binomial”.`,name:"distribution_output"},{anchor:"transformers.AutoformerConfig.loss",description:`<strong>loss</strong> (<code>string</code>, <em>optional</em>, defaults to <code>"nll"</code>) — | |
| The loss function for the model corresponding to the <code>distribution_output</code> head. For parametric | |
| distributions it is the negative log likelihood (nll) - which currently is the only supported one.`,name:"loss"},{anchor:"transformers.AutoformerConfig.input_size",description:`<strong>input_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The size of the target variable which by default is 1 for univariate targets. Would be > 1 in case of | |
| multivariate targets.`,name:"input_size"},{anchor:"transformers.AutoformerConfig.lags_sequence",description:`<strong>lags_sequence</strong> (<code>list[int]</code>, <em>optional</em>, defaults to <code>[1, 2, 3, 4, 5, 6, 7]</code>) — | |
| The lags of the input time series as covariates often dictated by the frequency. Default is <code>[1, 2, 3, 4, 5, 6, 7]</code>.`,name:"lags_sequence"},{anchor:"transformers.AutoformerConfig.scaling",description:`<strong>scaling</strong> (<code>bool</code>, <em>optional</em> defaults to <code>True</code>) — | |
| Whether to scale the input targets.`,name:"scaling"},{anchor:"transformers.AutoformerConfig.num_time_features",description:`<strong>num_time_features</strong> (<code>int</code>, <em>optional</em>, defaults to 0) — | |
| The number of time features in the input time series.`,name:"num_time_features"},{anchor:"transformers.AutoformerConfig.num_dynamic_real_features",description:`<strong>num_dynamic_real_features</strong> (<code>int</code>, <em>optional</em>, defaults to 0) — | |
| The number of dynamic real valued features.`,name:"num_dynamic_real_features"},{anchor:"transformers.AutoformerConfig.num_static_categorical_features",description:`<strong>num_static_categorical_features</strong> (<code>int</code>, <em>optional</em>, defaults to 0) — | |
| The number of static categorical features.`,name:"num_static_categorical_features"},{anchor:"transformers.AutoformerConfig.num_static_real_features",description:`<strong>num_static_real_features</strong> (<code>int</code>, <em>optional</em>, defaults to 0) — | |
| The number of static real valued features.`,name:"num_static_real_features"},{anchor:"transformers.AutoformerConfig.cardinality",description:`<strong>cardinality</strong> (<code>list[int]</code>, <em>optional</em>) — | |
| The cardinality (number of different values) for each of the static categorical features. Should be a list | |
| of integers, having the same length as <code>num_static_categorical_features</code>. Cannot be <code>None</code> if | |
| <code>num_static_categorical_features</code> is > 0.`,name:"cardinality"},{anchor:"transformers.AutoformerConfig.embedding_dimension",description:`<strong>embedding_dimension</strong> (<code>list[int]</code>, <em>optional</em>) — | |
| Dimensionality of the embeddings and hidden states.`,name:"embedding_dimension"},{anchor:"transformers.AutoformerConfig.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to <code>64</code>) — | |
| Size of the encoder layers and the pooler layer.`,name:"d_model"},{anchor:"transformers.AutoformerConfig.encoder_attention_heads",description:`<strong>encoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| Number of attention heads for each attention layer in the Transformer encoder.`,name:"encoder_attention_heads"},{anchor:"transformers.AutoformerConfig.decoder_attention_heads",description:`<strong>decoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| Number of attention heads for each attention layer in the Transformer decoder.`,name:"decoder_attention_heads"},{anchor:"transformers.AutoformerConfig.encoder_layers",description:`<strong>encoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| Number of hidden layers in the Transformer encoder. Will use the same value as <code>num_layers</code> if not set.`,name:"encoder_layers"},{anchor:"transformers.AutoformerConfig.decoder_layers",description:`<strong>decoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| Number of hidden layers in the Transformer decoder. Will use the same value as <code>num_layers</code> if not set.`,name:"decoder_layers"},{anchor:"transformers.AutoformerConfig.encoder_ffn_dim",description:`<strong>encoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) — | |
| Dimensionality of the “intermediate” (often named feed-forward) layer in encoder.`,name:"encoder_ffn_dim"},{anchor:"transformers.AutoformerConfig.decoder_ffn_dim",description:`<strong>decoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) — | |
| Dimensionality of the “intermediate” (often named feed-forward) layer in decoder.`,name:"decoder_ffn_dim"},{anchor:"transformers.AutoformerConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>gelu</code>) — | |
| The non-linear activation function (function or string) in the decoder. For example, <code>"gelu"</code>, | |
| <code>"relu"</code>, <code>"silu"</code>, etc.`,name:"activation_function"},{anchor:"transformers.AutoformerConfig.dropout",description:`<strong>dropout</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.1</code>) — | |
| The ratio for all dropout layers.`,name:"dropout"},{anchor:"transformers.AutoformerConfig.encoder_layerdrop",description:`<strong>encoder_layerdrop</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.1</code>) — | |
| The LayerDrop probability for the encoder. See the [LayerDrop paper](see <a href="https://huggingface.co/papers/1909.11556" rel="nofollow">https://huggingface.co/papers/1909.11556</a>) | |
| for more details.`,name:"encoder_layerdrop"},{anchor:"transformers.AutoformerConfig.decoder_layerdrop",description:`<strong>decoder_layerdrop</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.1</code>) — | |
| The LayerDrop probability for the decoder. See the [LayerDrop paper](see <a href="https://huggingface.co/papers/1909.11556" rel="nofollow">https://huggingface.co/papers/1909.11556</a>) | |
| for more details.`,name:"decoder_layerdrop"},{anchor:"transformers.AutoformerConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.1</code>) — | |
| The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.AutoformerConfig.activation_dropout",description:`<strong>activation_dropout</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.1</code>) — | |
| The dropout ratio for activations inside the fully connected layer.`,name:"activation_dropout"},{anchor:"transformers.AutoformerConfig.num_parallel_samples",description:`<strong>num_parallel_samples</strong> (<code>int</code>, <em>optional</em>, defaults to 100) — | |
| The number of samples to generate in parallel for each time step of inference.`,name:"num_parallel_samples"},{anchor:"transformers.AutoformerConfig.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.02</code>) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"init_std"},{anchor:"transformers.AutoformerConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not the model should return the last key/values attentions (not used by all models). Only | |
| relevant if <code>config.is_decoder=True</code> or when the model is a decoder-only generative model.`,name:"use_cache"},{anchor:"transformers.AutoformerConfig.label_length",description:`<strong>label_length</strong> (<code>int</code>, <em>optional</em>, defaults to 10) — | |
| Start token length of the Autoformer decoder, which is used for direct multi-step prediction (i.e. | |
| non-autoregressive generation).`,name:"label_length"},{anchor:"transformers.AutoformerConfig.moving_average",description:`<strong>moving_average</strong> (<code>int</code>, <em>optional</em>, defaults to 25) — | |
| The window size of the moving average. In practice, it’s the kernel size in AvgPool1d of the Decomposition | |
| Layer.`,name:"moving_average"},{anchor:"transformers.AutoformerConfig.autocorrelation_factor",description:`<strong>autocorrelation_factor</strong> (<code>int</code>, <em>optional</em>, defaults to 3) — | |
| “Attention” (i.e. AutoCorrelation mechanism) factor which is used to find top k autocorrelations delays. | |
| It’s recommended in the paper to set it to a number between 1 and 5.`,name:"autocorrelation_factor"}],source:"https://github.com/huggingface/transformers/blob/vr_43838/src/transformers/models/autoformer/configuration_autoformer.py#L24"}}),z=new qe({props:{anchor:"transformers.AutoformerConfig.example",$$slots:{default:[Bt]},$$scope:{ctx:w}}}),K=new ve({props:{title:"AutoformerModel",local:"transformers.AutoformerModel",headingTag:"h2"}}),ee=new we({props:{name:"class transformers.AutoformerModel",anchor:"transformers.AutoformerModel",parameters:[{name:"config",val:": AutoformerConfig"}],parametersDescription:[{anchor:"transformers.AutoformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_43838/en/model_doc/autoformer#transformers.AutoformerConfig">AutoformerConfig</a>) — | |
| 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/pr_43838/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/vr_43838/src/transformers/models/autoformer/modeling_autoformer.py#L1025"}}),te=new we({props:{name:"forward",anchor:"transformers.AutoformerModel.forward",parameters:[{name:"past_values",val:": Tensor"},{name:"past_time_features",val:": Tensor"},{name:"past_observed_mask",val:": Tensor"},{name:"static_categorical_features",val:": torch.Tensor | None = None"},{name:"static_real_features",val:": torch.Tensor | None = None"},{name:"future_values",val:": torch.Tensor | None = None"},{name:"future_time_features",val:": torch.Tensor | None = None"},{name:"decoder_attention_mask",val:": torch.LongTensor | None = None"},{name:"encoder_outputs",val:": list[torch.FloatTensor] | None = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"use_cache",val:": bool | None = None"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.utils.generic.TransformersKwargs]"}],parametersDescription:[{anchor:"transformers.AutoformerModel.forward.past_values",description:`<strong>past_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Past values of the time series, that serve as context in order to predict the future. These values may | |
| contain lags, i.e. additional values from the past which are added in order to serve as “extra context”. | |
| The <code>past_values</code> is what the Transformer encoder gets as input (with optional additional features, such as | |
| <code>static_categorical_features</code>, <code>static_real_features</code>, <code>past_time_features</code>).</p> | |
| <p>The sequence length here is equal to <code>context_length</code> + <code>max(config.lags_sequence)</code>.</p> | |
| <p>Missing values need to be replaced with zeros.`,name:"past_values"},{anchor:"transformers.AutoformerModel.forward.past_time_features",description:`<strong>past_time_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, num_features)</code>, <em>optional</em>) — | |
| Optional time features, which the model internally will add to <code>past_values</code>. These could be things like | |
| “month of year”, “day of the month”, etc. encoded as vectors (for instance as Fourier features). These | |
| could also be so-called “age” features, which basically help the model know “at which point in life” a | |
| time-series is. Age features have small values for distant past time steps and increase monotonically the | |
| more we approach the current time step.</p> | |
| <p>These features serve as the “positional encodings” of the inputs. So contrary to a model like BERT, where | |
| the position encodings are learned from scratch internally as parameters of the model, the Time Series | |
| Transformer requires to provide additional time features.</p> | |
| <p>The Autoformer only learns additional embeddings for <code>static_categorical_features</code>.`,name:"past_time_features"},{anchor:"transformers.AutoformerModel.forward.past_observed_mask",description:`<strong>past_observed_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Boolean mask to indicate which <code>past_values</code> were observed and which were missing. Mask values selected in | |
| <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for values that are <strong>observed</strong>,</li> | |
| <li>0 for values that are <strong>missing</strong> (i.e. NaNs that were replaced by zeros).</li> | |
| </ul>`,name:"past_observed_mask"},{anchor:"transformers.AutoformerModel.forward.static_categorical_features",description:`<strong>static_categorical_features</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, number of static categorical features)</code>, <em>optional</em>) — | |
| Optional static categorical features for which the model will learn an embedding, which it will add to the | |
| values of the time series.</p> | |
| <p>Static categorical features are features which have the same value for all time steps (static over time).</p> | |
| <p>A typical example of a static categorical feature is a time series ID.`,name:"static_categorical_features"},{anchor:"transformers.AutoformerModel.forward.static_real_features",description:`<strong>static_real_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, number of static real features)</code>, <em>optional</em>) — | |
| Optional static real features which the model will add to the values of the time series.</p> | |
| <p>Static real features are features which have the same value for all time steps (static over time).</p> | |
| <p>A typical example of a static real feature is promotion information.`,name:"static_real_features"},{anchor:"transformers.AutoformerModel.forward.future_values",description:`<strong>future_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, prediction_length)</code>) — | |
| Future values of the time series, that serve as labels for the model. The <code>future_values</code> is what the | |
| Transformer needs to learn to output, given the <code>past_values</code>.</p> | |
| <p>See the demo notebook and code snippets for details.</p> | |
| <p>Missing values need to be replaced with zeros.`,name:"future_values"},{anchor:"transformers.AutoformerModel.forward.future_time_features",description:`<strong>future_time_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, prediction_length, num_features)</code>, <em>optional</em>) — | |
| Optional time features, which the model internally will add to <code>future_values</code>. These could be things like | |
| “month of year”, “day of the month”, etc. encoded as vectors (for instance as Fourier features). These | |
| could also be so-called “age” features, which basically help the model know “at which point in life” a | |
| time-series is. Age features have small values for distant past time steps and increase monotonically the | |
| more we approach the current time step.</p> | |
| <p>These features serve as the “positional encodings” of the inputs. So contrary to a model like BERT, where | |
| the position encodings are learned from scratch internally as parameters of the model, the Time Series | |
| Transformer requires to provide additional features.</p> | |
| <p>The Autoformer only learns additional embeddings for <code>static_categorical_features</code>.`,name:"future_time_features"},{anchor:"transformers.AutoformerModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on certain token indices. By default, a causal mask will be used, to | |
| make sure the model can only look at previous inputs in order to predict the future.`,name:"decoder_attention_mask"},{anchor:"transformers.AutoformerModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) — | |
| Tuple consists of <code>last_hidden_state</code>, <code>hidden_states</code> (<em>optional</em>) and <code>attentions</code> (<em>optional</em>) | |
| <code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> (<em>optional</em>) is a sequence of | |
| hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.AutoformerModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_43838/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_43838/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.AutoformerModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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/vr_43838/src/transformers/models/autoformer/modeling_autoformer.py#L1193",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>AutoformerModelOutput</code> 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/pr_43838/en/model_doc/autoformer#transformers.AutoformerConfig" | |
| >AutoformerConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>AutoformerModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),W=new mt({props:{$$slots:{default:[Rt]},$$scope:{ctx:w}}}),N=new qe({props:{anchor:"transformers.AutoformerModel.forward.example",$$slots:{default:[Gt]},$$scope:{ctx:w}}}),oe=new ve({props:{title:"AutoformerForPrediction",local:"transformers.AutoformerForPrediction",headingTag:"h2"}}),ae=new we({props:{name:"class transformers.AutoformerForPrediction",anchor:"transformers.AutoformerForPrediction",parameters:[{name:"config",val:": AutoformerConfig"}],parametersDescription:[{anchor:"transformers.AutoformerForPrediction.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_43838/en/model_doc/autoformer#transformers.AutoformerConfig">AutoformerConfig</a>) — | |
| 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/pr_43838/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/vr_43838/src/transformers/models/autoformer/modeling_autoformer.py#L1391"}}),se=new we({props:{name:"forward",anchor:"transformers.AutoformerForPrediction.forward",parameters:[{name:"past_values",val:": Tensor"},{name:"past_time_features",val:": Tensor"},{name:"past_observed_mask",val:": Tensor"},{name:"static_categorical_features",val:": torch.Tensor | None = None"},{name:"static_real_features",val:": torch.Tensor | None = None"},{name:"future_values",val:": torch.Tensor | None = None"},{name:"future_time_features",val:": torch.Tensor | None = None"},{name:"future_observed_mask",val:": torch.Tensor | None = None"},{name:"decoder_attention_mask",val:": torch.LongTensor | None = None"},{name:"encoder_outputs",val:": list[torch.FloatTensor] | None = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"use_cache",val:": bool | None = None"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.utils.generic.TransformersKwargs]"}],parametersDescription:[{anchor:"transformers.AutoformerForPrediction.forward.past_values",description:`<strong>past_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Past values of the time series, that serve as context in order to predict the future. These values may | |
| contain lags, i.e. additional values from the past which are added in order to serve as “extra context”. | |
| The <code>past_values</code> is what the Transformer encoder gets as input (with optional additional features, such as | |
| <code>static_categorical_features</code>, <code>static_real_features</code>, <code>past_time_features</code>).</p> | |
| <p>The sequence length here is equal to <code>context_length</code> + <code>max(config.lags_sequence)</code>.</p> | |
| <p>Missing values need to be replaced with zeros.`,name:"past_values"},{anchor:"transformers.AutoformerForPrediction.forward.past_time_features",description:`<strong>past_time_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, num_features)</code>, <em>optional</em>) — | |
| Optional time features, which the model internally will add to <code>past_values</code>. These could be things like | |
| “month of year”, “day of the month”, etc. encoded as vectors (for instance as Fourier features). These | |
| could also be so-called “age” features, which basically help the model know “at which point in life” a | |
| time-series is. Age features have small values for distant past time steps and increase monotonically the | |
| more we approach the current time step.</p> | |
| <p>These features serve as the “positional encodings” of the inputs. So contrary to a model like BERT, where | |
| the position encodings are learned from scratch internally as parameters of the model, the Time Series | |
| Transformer requires to provide additional time features.</p> | |
| <p>The Autoformer only learns additional embeddings for <code>static_categorical_features</code>.`,name:"past_time_features"},{anchor:"transformers.AutoformerForPrediction.forward.past_observed_mask",description:`<strong>past_observed_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Boolean mask to indicate which <code>past_values</code> were observed and which were missing. Mask values selected in | |
| <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for values that are <strong>observed</strong>,</li> | |
| <li>0 for values that are <strong>missing</strong> (i.e. NaNs that were replaced by zeros).</li> | |
| </ul>`,name:"past_observed_mask"},{anchor:"transformers.AutoformerForPrediction.forward.static_categorical_features",description:`<strong>static_categorical_features</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, number of static categorical features)</code>, <em>optional</em>) — | |
| Optional static categorical features for which the model will learn an embedding, which it will add to the | |
| values of the time series.</p> | |
| <p>Static categorical features are features which have the same value for all time steps (static over time).</p> | |
| <p>A typical example of a static categorical feature is a time series ID.`,name:"static_categorical_features"},{anchor:"transformers.AutoformerForPrediction.forward.static_real_features",description:`<strong>static_real_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, number of static real features)</code>, <em>optional</em>) — | |
| Optional static real features which the model will add to the values of the time series.</p> | |
| <p>Static real features are features which have the same value for all time steps (static over time).</p> | |
| <p>A typical example of a static real feature is promotion information.`,name:"static_real_features"},{anchor:"transformers.AutoformerForPrediction.forward.future_values",description:`<strong>future_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, prediction_length)</code>) — | |
| Future values of the time series, that serve as labels for the model. The <code>future_values</code> is what the | |
| Transformer needs to learn to output, given the <code>past_values</code>.</p> | |
| <p>See the demo notebook and code snippets for details.</p> | |
| <p>Missing values need to be replaced with zeros.`,name:"future_values"},{anchor:"transformers.AutoformerForPrediction.forward.future_time_features",description:`<strong>future_time_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, prediction_length, num_features)</code>, <em>optional</em>) — | |
| Optional time features, which the model internally will add to <code>future_values</code>. These could be things like | |
| “month of year”, “day of the month”, etc. encoded as vectors (for instance as Fourier features). These | |
| could also be so-called “age” features, which basically help the model know “at which point in life” a | |
| time-series is. Age features have small values for distant past time steps and increase monotonically the | |
| more we approach the current time step.</p> | |
| <p>These features serve as the “positional encodings” of the inputs. So contrary to a model like BERT, where | |
| the position encodings are learned from scratch internally as parameters of the model, the Time Series | |
| Transformer requires to provide additional features.</p> | |
| <p>The Autoformer only learns additional embeddings for <code>static_categorical_features</code>.`,name:"future_time_features"},{anchor:"transformers.AutoformerForPrediction.forward.future_observed_mask",description:`<strong>future_observed_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length)</code> or <code>(batch_size, sequence_length, input_size)</code>, <em>optional</em>) — | |
| Boolean mask to indicate which <code>future_values</code> were observed and which were missing. Mask values selected | |
| in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for values that are <strong>observed</strong>,</li> | |
| <li>0 for values that are <strong>missing</strong> (i.e. NaNs that were replaced by zeros).</li> | |
| </ul> | |
| <p>This mask is used to filter out missing values for the final loss calculation.`,name:"future_observed_mask"},{anchor:"transformers.AutoformerForPrediction.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on certain token indices. By default, a causal mask will be used, to | |
| make sure the model can only look at previous inputs in order to predict the future.`,name:"decoder_attention_mask"},{anchor:"transformers.AutoformerForPrediction.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) — | |
| Tuple consists of <code>last_hidden_state</code>, <code>hidden_states</code> (<em>optional</em>) and <code>attentions</code> (<em>optional</em>) | |
| <code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code> (<em>optional</em>) is a sequence of | |
| hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.AutoformerForPrediction.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_43838/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_43838/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.AutoformerForPrediction.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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/vr_43838/src/transformers/models/autoformer/modeling_autoformer.py#L1425",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_43838/en/main_classes/output#transformers.modeling_outputs.Seq2SeqTSPredictionOutput" | |
| >Seq2SeqTSPredictionOutput</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/pr_43838/en/model_doc/autoformer#transformers.AutoformerConfig" | |
| >AutoformerConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_43838/en/main_classes/output#transformers.modeling_outputs.Seq2SeqTSPredictionOutput" | |
| >Seq2SeqTSPredictionOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),V=new mt({props:{$$slots:{default:[Yt]},$$scope:{ctx:w}}}),B=new qe({props:{anchor:"transformers.AutoformerForPrediction.forward.example",$$slots:{default:[qt]},$$scope:{ctx:w}}}),R=new mt({props:{$$slots:{default:[Et]},$$scope:{ctx:w}}}),ne=new Vt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/autoformer.md"}}),{c(){o=m("meta"),g=r(),c=m("p"),n=r(),u=m("p"),u.innerHTML=t,h=r(),_(X.$$.fragment),je=r(),_(G.$$.fragment),Ce=r(),_(Y.$$.fragment),Je=r(),q=m("p"),q.innerHTML=pt,xe=r(),I=m("p"),I.textContent=ut,Ue=r(),E=m("p"),E.textContent=ht,$e=r(),H=m("p"),H.innerHTML=ft,ke=r(),S=m("p"),S.innerHTML=gt,Ze=r(),_(P.$$.fragment),Fe=r(),Q=m("p"),Q.textContent=_t,Ae=r(),L=m("ul"),L.innerHTML=yt,Xe=r(),_(D.$$.fragment),ze=r(),$=m("div"),_(O.$$.fragment),Ee=r(),ie=m("p"),ie.innerHTML=bt,He=r(),ce=m("p"),ce.innerHTML=vt,Se=r(),_(z.$$.fragment),We=r(),_(K.$$.fragment),Ne=r(),C=m("div"),_(ee.$$.fragment),Pe=r(),de=m("p"),de.textContent=Mt,Qe=r(),me=m("p"),me.innerHTML=Tt,Le=r(),pe=m("p"),pe.innerHTML=wt,De=r(),U=m("div"),_(te.$$.fragment),Oe=r(),ue=m("p"),ue.innerHTML=jt,Ke=r(),_(W.$$.fragment),et=r(),he=m("ul"),he.innerHTML=Ct,tt=r(),_(N.$$.fragment),Ve=r(),_(oe.$$.fragment),Be=r(),J=m("div"),_(ae.$$.fragment),ot=r(),fe=m("p"),fe.textContent=Jt,at=r(),ge=m("p"),ge.innerHTML=xt,st=r(),_e=m("p"),_e.innerHTML=Ut,nt=r(),j=m("div"),_(se.$$.fragment),rt=r(),ye=m("p"),ye.innerHTML=$t,lt=r(),_(V.$$.fragment),it=r(),be=m("ul"),be.innerHTML=kt,ct=r(),_(B.$$.fragment),dt=r(),_(R.$$.fragment),Re=r(),_(ne.$$.fragment),Ge=r(),Te=m("p"),this.h()},l(e){const a=Wt("svelte-u9bgzb",document.head);o=p(a,"META",{name:!0,content:!0}),a.forEach(s),g=l(e),c=p(e,"P",{}),re(c).forEach(s),n=l(e),u=p(e,"P",{"data-svelte-h":!0}),f(u)!=="svelte-1biwvd4"&&(u.innerHTML=t),h=l(e),y(X.$$.fragment,e),je=l(e),y(G.$$.fragment,e),Ce=l(e),y(Y.$$.fragment,e),Je=l(e),q=p(e,"P",{"data-svelte-h":!0}),f(q)!=="svelte-7uqw5b"&&(q.innerHTML=pt),xe=l(e),I=p(e,"P",{"data-svelte-h":!0}),f(I)!=="svelte-1ki0fyb"&&(I.textContent=ut),Ue=l(e),E=p(e,"P",{"data-svelte-h":!0}),f(E)!=="svelte-vfdo9a"&&(E.textContent=ht),$e=l(e),H=p(e,"P",{"data-svelte-h":!0}),f(H)!=="svelte-o037y5"&&(H.innerHTML=ft),ke=l(e),S=p(e,"P",{"data-svelte-h":!0}),f(S)!=="svelte-1twzwdn"&&(S.innerHTML=gt),Ze=l(e),y(P.$$.fragment,e),Fe=l(e),Q=p(e,"P",{"data-svelte-h":!0}),f(Q)!=="svelte-1e7xzkp"&&(Q.textContent=_t),Ae=l(e),L=p(e,"UL",{"data-svelte-h":!0}),f(L)!=="svelte-s0tqjc"&&(L.innerHTML=yt),Xe=l(e),y(D.$$.fragment,e),ze=l(e),$=p(e,"DIV",{class:!0});var A=re($);y(O.$$.fragment,A),Ee=l(A),ie=p(A,"P",{"data-svelte-h":!0}),f(ie)!=="svelte-1phivoi"&&(ie.innerHTML=bt),He=l(A),ce=p(A,"P",{"data-svelte-h":!0}),f(ce)!=="svelte-13zebiv"&&(ce.innerHTML=vt),Se=l(A),y(z.$$.fragment,A),A.forEach(s),We=l(e),y(K.$$.fragment,e),Ne=l(e),C=p(e,"DIV",{class:!0});var k=re(C);y(ee.$$.fragment,k),Pe=l(k),de=p(k,"P",{"data-svelte-h":!0}),f(de)!=="svelte-c8j2uu"&&(de.textContent=Mt),Qe=l(k),me=p(k,"P",{"data-svelte-h":!0}),f(me)!=="svelte-9isq9w"&&(me.innerHTML=Tt),Le=l(k),pe=p(k,"P",{"data-svelte-h":!0}),f(pe)!=="svelte-hswkmf"&&(pe.innerHTML=wt),De=l(k),U=p(k,"DIV",{class:!0});var Z=re(U);y(te.$$.fragment,Z),Oe=l(Z),ue=p(Z,"P",{"data-svelte-h":!0}),f(ue)!=="svelte-9hn7rh"&&(ue.innerHTML=jt),Ke=l(Z),y(W.$$.fragment,Z),et=l(Z),he=p(Z,"UL",{"data-svelte-h":!0}),f(he)!=="svelte-1fix1je"&&(he.innerHTML=Ct),tt=l(Z),y(N.$$.fragment,Z),Z.forEach(s),k.forEach(s),Ve=l(e),y(oe.$$.fragment,e),Be=l(e),J=p(e,"DIV",{class:!0});var F=re(J);y(ae.$$.fragment,F),ot=l(F),fe=p(F,"P",{"data-svelte-h":!0}),f(fe)!=="svelte-1gxg89a"&&(fe.textContent=Jt),at=l(F),ge=p(F,"P",{"data-svelte-h":!0}),f(ge)!=="svelte-9isq9w"&&(ge.innerHTML=xt),st=l(F),_e=p(F,"P",{"data-svelte-h":!0}),f(_e)!=="svelte-hswkmf"&&(_e.innerHTML=Ut),nt=l(F),j=p(F,"DIV",{class:!0});var x=re(j);y(se.$$.fragment,x),rt=l(x),ye=p(x,"P",{"data-svelte-h":!0}),f(ye)!=="svelte-jhvjw5"&&(ye.innerHTML=$t),lt=l(x),y(V.$$.fragment,x),it=l(x),be=p(x,"UL",{"data-svelte-h":!0}),f(be)!=="svelte-nsize7"&&(be.innerHTML=kt),ct=l(x),y(B.$$.fragment,x),dt=l(x),y(R.$$.fragment,x),x.forEach(s),F.forEach(s),Re=l(e),y(ne.$$.fragment,e),Ge=l(e),Te=p(e,"P",{}),re(Te).forEach(s),this.h()},h(){le(o,"name","hf:doc:metadata"),le(o,"content",St),le($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),le(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),le(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),le(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),le(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,a){d(document.head,o),i(e,g,a),i(e,c,a),i(e,n,a),i(e,u,a),i(e,h,a),b(X,e,a),i(e,je,a),b(G,e,a),i(e,Ce,a),b(Y,e,a),i(e,Je,a),i(e,q,a),i(e,xe,a),i(e,I,a),i(e,Ue,a),i(e,E,a),i(e,$e,a),i(e,H,a),i(e,ke,a),i(e,S,a),i(e,Ze,a),b(P,e,a),i(e,Fe,a),i(e,Q,a),i(e,Ae,a),i(e,L,a),i(e,Xe,a),b(D,e,a),i(e,ze,a),i(e,$,a),b(O,$,null),d($,Ee),d($,ie),d($,He),d($,ce),d($,Se),b(z,$,null),i(e,We,a),b(K,e,a),i(e,Ne,a),i(e,C,a),b(ee,C,null),d(C,Pe),d(C,de),d(C,Qe),d(C,me),d(C,Le),d(C,pe),d(C,De),d(C,U),b(te,U,null),d(U,Oe),d(U,ue),d(U,Ke),b(W,U,null),d(U,et),d(U,he),d(U,tt),b(N,U,null),i(e,Ve,a),b(oe,e,a),i(e,Be,a),i(e,J,a),b(ae,J,null),d(J,ot),d(J,fe),d(J,at),d(J,ge),d(J,st),d(J,_e),d(J,nt),d(J,j),b(se,j,null),d(j,rt),d(j,ye),d(j,lt),b(V,j,null),d(j,it),d(j,be),d(j,ct),b(B,j,null),d(j,dt),b(R,j,null),i(e,Re,a),b(ne,e,a),i(e,Ge,a),i(e,Te,a),Ye=!0},p(e,[a]){const A={};a&2&&(A.$$scope={dirty:a,ctx:e}),z.$set(A);const k={};a&2&&(k.$$scope={dirty:a,ctx:e}),W.$set(k);const Z={};a&2&&(Z.$$scope={dirty:a,ctx:e}),N.$set(Z);const F={};a&2&&(F.$$scope={dirty:a,ctx:e}),V.$set(F);const x={};a&2&&(x.$$scope={dirty:a,ctx:e}),B.$set(x);const Zt={};a&2&&(Zt.$$scope={dirty:a,ctx:e}),R.$set(Zt)},i(e){Ye||(v(X.$$.fragment,e),v(G.$$.fragment,e),v(Y.$$.fragment,e),v(P.$$.fragment,e),v(D.$$.fragment,e),v(O.$$.fragment,e),v(z.$$.fragment,e),v(K.$$.fragment,e),v(ee.$$.fragment,e),v(te.$$.fragment,e),v(W.$$.fragment,e),v(N.$$.fragment,e),v(oe.$$.fragment,e),v(ae.$$.fragment,e),v(se.$$.fragment,e),v(V.$$.fragment,e),v(B.$$.fragment,e),v(R.$$.fragment,e),v(ne.$$.fragment,e),Ye=!0)},o(e){M(X.$$.fragment,e),M(G.$$.fragment,e),M(Y.$$.fragment,e),M(P.$$.fragment,e),M(D.$$.fragment,e),M(O.$$.fragment,e),M(z.$$.fragment,e),M(K.$$.fragment,e),M(ee.$$.fragment,e),M(te.$$.fragment,e),M(W.$$.fragment,e),M(N.$$.fragment,e),M(oe.$$.fragment,e),M(ae.$$.fragment,e),M(se.$$.fragment,e),M(V.$$.fragment,e),M(B.$$.fragment,e),M(R.$$.fragment,e),M(ne.$$.fragment,e),Ye=!1},d(e){e&&(s(g),s(c),s(n),s(u),s(h),s(je),s(Ce),s(Je),s(q),s(xe),s(I),s(Ue),s(E),s($e),s(H),s(ke),s(S),s(Ze),s(Fe),s(Q),s(Ae),s(L),s(Xe),s(ze),s($),s(We),s(Ne),s(C),s(Ve),s(Be),s(J),s(Re),s(Ge),s(Te)),s(o),T(X,e),T(G,e),T(Y,e),T(P,e),T(D,e),T(O),T(z),T(K,e),T(ee),T(te),T(W),T(N),T(oe,e),T(ae),T(se),T(V),T(B),T(R),T(ne,e)}}}const St='{"title":"Autoformer","local":"autoformer","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"AutoformerConfig","local":"transformers.AutoformerConfig","sections":[],"depth":2},{"title":"AutoformerModel","local":"transformers.AutoformerModel","sections":[],"depth":2},{"title":"AutoformerForPrediction","local":"transformers.AutoformerForPrediction","sections":[],"depth":2}],"depth":1}';function Pt(w){return At(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ao extends Xt{constructor(o){super(),zt(this,o,Pt,Ht,Ft,{})}}export{ao as component}; | |
Xet Storage Details
- Size:
- 81.3 kB
- Xet hash:
- 6572295413b125426be2b88f3b2949849cbd71dfc3429ed4fcbb04a6d00b6a46
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.