category
stringclasses
107 values
title
stringlengths
15
179
question_link
stringlengths
59
147
question_body
stringlengths
53
33.8k
answer_html
stringlengths
0
28.8k
__index_level_0__
int64
0
1.58k
question answering
What all can be said when you say that the CPU is 32 bit?
https://cs.stackexchange.com/questions/63001/what-all-can-be-said-when-you-say-that-the-cpu-is-32-bit
<p>When someone tells a computer scientist that a CPU is, say, 32 bits, what all does he/she infer from this information?</p> <p>I know that it means that the physical address has 32 bits. This meas that the physical memory can't hold more that 2^32 bytes of RAM. This also means that the word size is 32 bit or 4 bytes...
<p>An $n$-bit processor is a processor for which the preferred integer size is $n$ bits. That's usually the size of the integer or general purpose registers (a processor may not have exposed registers in its ISA, a processor may have some other kind of registers of different width, a processor may provide instructions...
700
question answering
Providing an algorithm for a given PDA
https://cs.stackexchange.com/questions/75673/providing-an-algorithm-for-a-given-pda
<p>I was asked the next question in my homework assignment: I just want to make sure that I fully understand what it is that's required of me. Am I asked to find an algorithm which decides if the language that's accepted by the PDA is finite? And if not, then what is it? Any initial intuition?</p> <p>**I don't need he...
701
question answering
Chordal graph question
https://cs.stackexchange.com/questions/109141/chordal-graph-question
<p>In the below image, the graph is being triangulated (added edges are in red). My question is simple :<br> <strong>Is the red edge between nodes 7 and 10 necessary in order to obtain a chordal graph?</strong></p> <p><a href="https://i.sstatic.net/AXKEV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/A...
<p>No, it's not necessary.</p> <p>Let <span class="math-container">$G$</span> be the graph made by deleting the edge <span class="math-container">$\{7,10\}$</span> from the graph in the question. Any cycle in&nbsp;<span class="math-container">$G$</span> that includes <span class="math-container">$7$</span> and&nbsp;<...
702
question answering
How to figure out the minimal number of colors needed to color specific given graphs?
https://cs.stackexchange.com/questions/29038/how-to-figure-out-the-minimal-number-of-colors-needed-to-color-specific-given-gr
<p>I found this question on the net and I'm wondering what is the process for answering such questions? I assume there is some formula that works for all graphs?</p> <p><strong>1.a.</strong> Consider the undirected graph with vertices $A$, $B$, $C$, $D$, $E$, $F$ and edges $AB$, $AC$, $BD$, $CE$, $DF$ and $EF$ (i.e.,...
<p>I'm not sure what you mean by a "formula that works for all graphs" &ndash; what would the variables of such a formula represent? Since it's <strong>NP</strong>-hard to determine the chromatic number of a graph (the minimum number of colours required), there's unlikely to be any simple way of doing it in general.</p...
703
question answering
Is there an online preprocessing algorithm for Range Minimum Queries (RMQ)?
https://cs.stackexchange.com/questions/130850/is-there-an-online-preprocessing-algorithm-for-range-minimum-queries-rmq
<p>Is there a linear time online version of the preprocessing RMQ algorithm? That is, an algorithm that allows to update the data structure when appending additional elements at the end of the input array in O(1) (worst case or amortized) time per element (while still allowing answering arbitrary queries in constant ti...
704
question answering
Could AI be used to detect when a human is picking survey response options randomly?
https://cs.stackexchange.com/questions/136928/could-ai-be-used-to-detect-when-a-human-is-picking-survey-response-options-rando
<p>Context: I am a clinical psych researcher dabbling in machine learning.</p> <p>Humans cannot be truly random. Therefore, could machine learning be used to analyze a string of numbers and determine the probability that said string was generated by a human or by a computer? Taking it a step further, could machine lear...
<p>AI is probably not the best tool for this job. Several classical techniques in survey design include:</p> <ul> <li><p>Consistency check: ask the same question in several ways, spread out across the survey, and check if they've answered consistently.</p> </li> <li><p>Open-ended questions: ask an open-ended question,...
705
question answering
Is there a concept of probabilistic quantum computers?
https://cs.stackexchange.com/questions/136178/is-there-a-concept-of-probabilistic-quantum-computers
<p>Answering <a href="https://cstheory.stackexchange.com/q/48527/61557">my question</a> <a href="https://cstheory.stackexchange.com/users/3532/yonatan-n">Yonatan N</a> said a statement from which follows that there are computable functions of quantum time complexity strictly above polynomial.</p> <p>Accordingly <a href...
<p>It is true that unitary gates used in quantum algorithms (and indeed any unitary evolution in quantum mechanics generally) is deterministic and measurements are the only non-deterministic elements in a quantum algorithm (and indeed in quantum mechanics generally). However, it is not true that measurement is always t...
706
question answering
Looking for interesting unanswered questions within complexity theory for a project
https://cs.stackexchange.com/questions/48552/looking-for-interesting-unanswered-questions-within-complexity-theory-for-a-proj
<p>I'm looking for interesting open questions in complexity theory that someone with an undergraduate degree in math and comp/sci could theoretically tackle. I have strong interest in the polynomial hierarchy, and the study of probabilistic classes like RP, co-RP, ZPP, BPP, and also their logarithmic counterparts. I al...
<p>Do something interesting with <a href="https://www.cis.upenn.edu/~alur/nw.html" rel="nofollow noreferrer">visibly</a> <a href="http://madhu.cs.illinois.edu/vpa/" rel="nofollow noreferrer">languages</a>. They are a relatively recent topic with many useful practical applications. For example, I would find it interesti...
707
question answering
A question about Fleury&#39;s algorithm
https://cs.stackexchange.com/questions/113122/a-question-about-fleurys-algorithm
<p>The following is the Problem 1.4 in [1]:</p> <p><strong>Finding an Eulerian path.</strong> Show that if a connected graph has two vertices of odd degree and we start at one of them, Fleury's algorithm will produce an Eulerian path, and that if all vertices have even degree, it (Fleury's algorithm) will produce an E...
708
question answering
Showing that tournament sort requrires O(n log n) comparisons
https://cs.stackexchange.com/questions/29900/showing-that-tournament-sort-requrires-on-log-n-comparisons
<p>I wish I could think of a better way to word my question. Maybe some one here could offer s suggestion for that, as well.</p> <p>On to my question. Before I do, this is a class question that has been asked, answer, and considered to be over; however, I'm struggle accepting the answer. For this reason, I'm here hopi...
<p>Initially you place the elements you want to sort in the leaves of the tournament tree. Then you fill all the internal nodes with the bigger of the two elements in their respective children. This takes $n-1$ comparisons.</p> <p>After that, you have the largest element in the root. So you can remove it and place it ...
709
question answering
Multiple knapsack problem with equal profit and different weight
https://cs.stackexchange.com/questions/109775/multiple-knapsack-problem-with-equal-profit-and-different-weight
<p>I am doing a research about the load balancing problem in 5G system, but I am not sure if my problem is a NP-complete problem.</p> <p>The problem is:</p> <ul> <li>given a set of n items and a set of m knapsack</li> <li>capacity of knapsacks are equal</li> <li>the weight of item j in knapsack i is w[i][j],that mean...
<p>This problem can be shown to be NP-complete via reduction from <a href="https://en.wikipedia.org/wiki/Partition_problem" rel="nofollow noreferrer">PARTITION</a>. Simply take <span class="math-container">$m=2$</span>, the weights of each item to be the same across both knapsacks, and the capacities of each knapsack t...
710
question answering
Question regarding $O(n^2)$ efficiency
https://cs.stackexchange.com/questions/87328/question-regarding-on2-efficiency
<p>I'm going through a video of EDX course which talks about Big O notation. At the end of the video they have some questions but the <span class="math-container">$O(n^2)$</span> answer is confusing me. It feels like a mistake, but I just want to make sure.</p> <p>The question is :</p> <blockquote> <p>Imagine that we h...
<p>Say the time spent is some constant factor $c$ times $n^2$. Then we have:</p> <p>$$c \cdot 10^2 = 10$$ $$c = 0.1$$</p> <p>Thus then $c\cdot 20^2 = 40$.</p>
711
question answering
Algorithm Selection for Classification problem
https://cs.stackexchange.com/questions/72018/algorithm-selection-for-classification-problem
<p>I've been working on a developing a product selection network for my workplace. I work with lots of chemicals and the clients don't always know what they want/need so most of the time I have to ask a bunch of question, collect useful/ignore useless information, then make a selection from there. Discussions take plac...
<p>I don't think existing state-of-the-art technology will be adequate to solve this task effectively. The current state of knowledge in NLP and AI probably isn't good enough to build something that will work well in practice. Instead, I think you'll need to use humans. Perhaps you can hire someone and train them ...
712
question answering
&#39;if&#39; and &#39;while&#39; statements within a SIMD architecture and its memory architecture
https://cs.stackexchange.com/questions/86154/if-and-while-statements-within-a-simd-architecture-and-its-memory-architectu
<p>I am doing some past exam papers and I found two interesting questions which I cannot answer due to them not being extensively covered in the lecture notes given to me by my lecturer. </p> <p>The questions go like this:</p> <blockquote> <p><strong>"Explain the mechanism a SIMD computer uses to support conditiona...
713
question answering
How can the 4-bit page number and 8-bit offset as well as the page table be used to a answer a question like, &quot;how big is each page&quot;? etc
https://cs.stackexchange.com/questions/123912/how-can-the-4-bit-page-number-and-8-bit-offset-as-well-as-the-page-table-be-used
<p>No more information required. I would just like to know how to use the information provided.</p> <p><a href="https://i.sstatic.net/xIOZk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xIOZk.png" alt="enter image description here"></a></p>
<p>4 bits page number + 8 bits offset = 12 address bits : A[11:0]</p> <ul> <li>A[7:0] selects an offset within a page</li> <li><p>A[11:8] selects the page</p></li> <li><p>1792 = 7*256 : A=0111_00000000</p></li> <li>2304 = 9*256 : A=1001_00000000</li> <li>2814 =11*256 : A=1011_00000000</li> <li>1024 = 4*256 : A=0100_00...
714
question answering
SAT solvers for use in $P^{NP}$ and $NP^{NP}$
https://cs.stackexchange.com/questions/139188/sat-solvers-for-use-in-pnp-and-npnp
<p>The original question I am answering:</p> <blockquote> <p>Can you use SAT solvers to solve problems complete in <span class="math-container">$\Sigma_2^P,\Pi_2^P,\Delta_2^P$</span>?</p> </blockquote> <p>My first thought:</p> <ul> <li>Venn Diagrams show that the PH encloses NP, but does not equal NP. Therefore, there ...
<p>We don't know that PH doesn't collapse to NP. We don't even know that PH doesn't collapse all the way to P.</p> <p>The best you can say is that you can use SAT solvers to solve problems in one of these classes iff PH collapses to NP.</p>
715
question answering
Comparative study between Deep neural nets and Bayesian Networks
https://cs.stackexchange.com/questions/60390/comparative-study-between-deep-neural-nets-and-bayesian-networks
<p>Is there any comparative study that showcases the powers of Bayesian Networks and Deep learning in their respective favorable setup and how they compare?</p> <p>I tried to go through blogs but couldn't find out any experimental study where the respective models where described based on a example?</p> <p>Rationale ...
<p>They're not directly comparable. They do different things. They solve different problems.</p> <p>A Bayesian network is a probabilistic model of the relationship between multiple random variables. It is a <a href="https://en.wikipedia.org/wiki/Generative_model" rel="nofollow">generative model</a>. It builds a mo...
716
question answering
return a key of a node with maximum value within a range of keys in B+ tree
https://cs.stackexchange.com/questions/86155/return-a-key-of-a-node-with-maximum-value-within-a-range-of-keys-in-b-tree
<p>I've been asked a question about B+ Tree.</p> <p><strong>The question is:</strong> Suppose we have object of the following type:</p> <p><code>class Obj { private: int value; int key; public: Obj(int uniq_key , int value) }</code></p> <p>and I am creating a Generic B+ tree which will sort objects in it...
<p>Augment each node to contain the key of the node with maximum value, among all nodes that are underneath it (among all of its descendants). You can easily maintain/update this augmented information each time you modify the tree, by using the fact that the maximum for any node can be recomputed using just the inform...
717
question answering
decider for a question not clear
https://cs.stackexchange.com/questions/127098/decider-for-a-question-not-clear
<p>This question was asked and answered but I cannot understand the solution.</p> <ol> <li>Why is it sufficient to test all strings of |Q| + 1 length?</li> <li>Why should special state q be found?</li> </ol> <p>the original question: <a href="https://cs.stackexchange.com/questions/43892/show-that-the-set-of-all-tms-t...
<p>The pigeonhole principle. If you go through <span class="math-container">$|Q|+1$</span> states, then there must be a state you have been in twice already. This means that because the input is <span class="math-container">$\sqcup$</span> almost all of the time, then we are stuck in a loop and the machine wont halt</p...
718
question answering
A question about the paper &quot;Ensembling Ten Math Information Retrieval Systems&quot;
https://cs.stackexchange.com/questions/144236/a-question-about-the-paper-ensembling-ten-math-information-retrieval-systems
<p>My question is about the paper <a href="http://ceur-ws.org/Vol-2936/paper-06.pdf" rel="nofollow noreferrer">Ensembling Ten Math Information Retrieval Systems</a>.</p> <p>I am interested in the task of finding answers.</p> <p>Which of the ten system are able to answer questions using <strong>only</strong> dot product...
<p>All ten systems are able to retrieve answers using only the dot product:</p> <ul> <li>All eight MSM systems (MG, PZ, MH, LM, MP, JK, AM, and VS) use <a href="https://en.wikipedia.org/wiki/Vector_space_model" rel="nofollow noreferrer">the standard vector space model (VSM)</a> with either the BM25 or TF-IDF weighting....
719
question answering
Binary Integer Programming question - what graph problem is represented
https://cs.stackexchange.com/questions/51377/binary-integer-programming-question-what-graph-problem-is-represented
<p>I'm dealing with a BIP question, that represents a graph problem. The goal is finding the graph problem.</p> <p>I've spend a lot of time trying to solving this question but I couldn't find the answer to that question.</p> <p>All I'm given is the set of constraints and the objective function:</p> <p>I'd really app...
<p>This answer assumes that $c_{ij} \geq 0$.</p> <p>The first two sets of equations guarantees that $x_{ij}$ is a permutation matrix. It defines a permutation $\pi$ on $\{0,\ldots,n-1\}$ in the following way: $\pi(j) = i$ if $x_{ij} = 1$.</p> <p>The set of inequalities is a logical implication: if $x_{ik}=x_{j(k+1)}=...
720
question answering
Go Back N ARQ Question
https://cs.stackexchange.com/questions/59724/go-back-n-arq-question
<p>I am a computer science under graduation student, and was going through some Go Back N ARQ (Computer Networking) videos on YouTube, and got a doubt in a question, which according to me should have a different answer than what the instructor on the video is arriving at (given that no other comment in the comments sec...
<p><code>1-2-3</code> is correctly sent and acknowledged so the sender's window is now over <code>4-5-6</code>.</p> <p><code>4</code> is received correctly and so it is acknowledged. This makes the window (currently over <code>4-5-6</code>) slide to <code>5-6-7</code>. However, since <code>5</code> was lost, <code>5</...
721
question answering
Simple question COQ
https://cs.stackexchange.com/questions/32707/simple-question-coq
<p>I'm a beginner in the coq proof assistant, so sorry if my question is silly. I would like to prove properties of a mathematical object. For clarity I will describe an over-simplified version of my object. Intuitively, the object has three sets A, B, C. The list A is of the form $$A= \{(0,x_1) (0,x_2), ... ,(0,x_n)\...
<p>Set-theoretic thinking is creating trouble, as you are trying to do things in non-Coq ways. Let me show you a solution which works better, and then you can explain what your actual non-simplified problem is -- we can probably optimize that one to.</p> <p>If we have two lists <code>A</code> and <code>B</code> then w...
722
question answering
How would I simulate a network to explore the percolation threshold of a network connected by the knight&#39;s move?
https://cs.stackexchange.com/questions/47992/how-would-i-simulate-a-network-to-explore-the-percolation-threshold-of-a-network
<p>"If we consider the squares of an infinite chess board as nodes of our graph and consider each to be connected to the other eight squares that are a knight's move away from it what is the percolation threshold of this graph?"</p> <p>Note:One way I have thought about this problem is to try to use vectors: We can thi...
<p>First of all, you don't simulate an infinite board. You simulate larger and larger boards, until the percolation threshold seems to stabilize. For a given size of board, you need to decide on what event signifies that percolation happens. One common option is that the top of the board is connected to the bottom of t...
723
question answering
Half Clique Property question
https://cs.stackexchange.com/questions/159653/half-clique-property-question
<p>Hey I had this question and am stuck on part (b).</p> <p>I don't see how its possible to find a graph with 7 vertices and 15 edges that does <strong>not</strong> have the half-clique problem. If there is a way, could someone share their thought process rather than the answer as I would like to figure it out on my ow...
<p>Consider a clique <span class="math-container">$C$</span> with vertex-set <span class="math-container">$V = \{1,2,3,4,5,6,7\}$</span>. <span class="math-container">$C$</span> has <span class="math-container">$\binom{7}{2} = \frac{6 \cdot 7}{2} = 21$</span> edges.</p> <p>For any <span class="math-container">$S \subse...
724
question answering
Analyzing parallel performance question
https://cs.stackexchange.com/questions/139303/analyzing-parallel-performance-question
<p>I was reviewing for my CS class and came across this question and answer combo that didn't have any explanation why it was correct. I'm confused on how they got the answer:</p> <blockquote> <p>We have a system to which we can instantaneously add and remove cores -- adding more cores never leads to slowdown from thin...
<p>Suppose that the fraction of <code>foo()</code> that is parallelizable is <span class="math-container">$\alpha$</span>. Then the total execution time with <span class="math-container">$n$</span> cores is:</p> <ul> <li>the non-parallelizable execution, done by only one core: <span class="math-container">$(1- \alpha)\...
725
question answering
Example of preservation failing in Java - follow up question
https://cs.stackexchange.com/questions/156781/example-of-preservation-failing-in-java-follow-up-question
<p>This is a <a href="https://cs.stackexchange.com/questions/156721/example-of-progress-and-preservation-failing-in-a-commonly-used-programming-lang">follow-up question to my previous question</a></p> <p>I have been reading <a href="https://medium.com/hackernoon/java-is-unsound-28c84cb2b3f#.xs8voadvf" rel="nofollow nor...
<p>The Java type system is strong. There are simply some errors that could, in theory, be reported at compile time that the Java Language Specification does not explicitly prohibit, and thus they are reported at run-time instead of compile time.</p> <p>This really isn't that complicated, and it's all spelled out in the...
726
question answering
Are there any research papers rethinking browser architecture?
https://cs.stackexchange.com/questions/57152/are-there-any-research-papers-rethinking-browser-architecture
<p>I am interested in any research that reviews the state of affairs when it comes to browsers today, be it their concurrency models, their performance, or anything relevant to such topics. Specifically, I am interested in whether any effors are being taken in academia to take on the shortcomings of browser design curr...
727
question answering
Finding the timestamps of processes implementing Lamport&#39;s clocks
https://cs.stackexchange.com/questions/126393/finding-the-timestamps-of-processes-implementing-lamports-clocks
<p>I have been asked this question, but don't know how to go about answering it. </p> <p>Three process, which are implementing Lamport's clocks, are running and a lot of events are taking, place including some messages being sent between the processes. The arrows and circles represent in-processor events and messages ...
728
question answering
Coefficients in cost function in A-star
https://cs.stackexchange.com/questions/114842/coefficients-in-cost-function-in-a-star
<p>I'd like to expand on this question : </p> <p><a href="https://stackoverflow.com/questions/52420788/why-does-the-a-star-algorithm-need-gn">https://stackoverflow.com/questions/52420788/why-does-the-a-star-algorithm-need-gn</a></p> <p>Dijkstra's algorithm uses cost function <span class="math-container">$f(n) = g(n)$...
<p>For A* to get the optimal path it requires that <span class="math-container">$f(n) \leq g(goal)$</span>. In other words that the heuristic underestimates the cost from the node to the goal.</p> <p>Multiplying a valid hueristic with <span class="math-container">$0 \lt\alpha\lt 1$</span> will not violate this require...
729
question answering
A question on decidability
https://cs.stackexchange.com/questions/140104/a-question-on-decidability
<p>I have a homework question that is as follows:</p> <p><em>L(P) is a language of ASCII input strings for which a given program, P, returns &quot;yes&quot;. Is the set of all input strings P decidable, such that P is a decision program and L(P) is decidable?</em></p> <p>My intuition leads me to believe that the set is...
<p>Let <span class="math-container">$L=\{\langle M \rangle \mid M \text{ is a TM such }L(M)\in R\}$</span>, where <span class="math-container">$\langle M\rangle$</span> is the encoding of a TM <span class="math-container">$M$</span>, and <span class="math-container">$R$</span> is the set of all decidable languages. Thi...
730
question answering
in order of binary search tree
https://cs.stackexchange.com/questions/115218/in-order-of-binary-search-tree
<p>This is what I got for the in-order of the bst but it's wrong because I'm answering some questions about some successors of some of the letters and I got them wrong. so I'm wondering where in this in-order i've gone wrong? <a href="https://i.sstatic.net/VRRAB.jpg" rel="nofollow noreferrer"><img src="https://i.sstati...
<p>Remember that an in-order traversal lists the elements from left-to-right, descending the tree: <code>Left</code>, <code>Root</code>, and <code>Right</code>. This means that starting from the root (<code>a</code>), we will traverse the whole left branch, <em>then</em> print <code>a</code>, and finally traverse the r...
731
question answering
Help with a question on write-through and no-write allocate in caches
https://cs.stackexchange.com/questions/155996/help-with-a-question-on-write-through-and-no-write-allocate-in-caches
<p>I am struggling with this question as I am not sure whether the answer that has been provided is correct or not. The image should be sufficient to tell the question. <br>The attached image is of the answer. For the question, imagine all but the first two columns are empty.<a href="https://i.sstatic.net/7Y0Ii.png" re...
732
question answering
Can an NP-hard problem be polynomial on average?
https://cs.stackexchange.com/questions/28466/can-an-np-hard-problem-be-polynomial-on-average
<p>I'm wondering if there are any $NP$-hard problems which are ``polynomial" in the average case. I think there are two ways to interpret this?</p> <ul> <li>If $P \neq NP$, can there be an algorithm solving an $NP$-hard problem with amortized (average case) running time of $O(n^k)$ for a constant $k$?</li> <li>Are the...
<p>It would seem that the question has been answered at <a href="https://cstheory.stackexchange.com/questions/496/are-there-np-complete-problems-with-polynomial-expected-time-solutions">CSTheory.SE</a>.</p> <p>Summary: it is, indeed possible.</p> <p>For example, the Max 2-CSP problem is NP hard with an $O(n)$ expecte...
733
question answering
Formal invalidation of question about self-referential partial halting problem solver
https://cs.stackexchange.com/questions/78057/formal-invalidation-of-question-about-self-referential-partial-halting-problem-s
<p>How do you formally invalidate a question about the decidability of a partial halting problem solver that answers correctly with the following kind of input: Turing machines that don't use the partial halting problem solver inside?</p> <p>I made this question and it was marked as unclear. I deleted it. This is my q...
734
question answering
Associativity Question , Computer organization
https://cs.stackexchange.com/questions/68701/associativity-question-computer-organization
<p>an access sequence of cache block address of length N and contaons n unique addresses. The no. of unique block address between 2 consecutive accesses to the same block address is bound above by k. What is miss ratio if access sequence is passed through a cache of associativity A >= k exercising LRU replacement polic...
<p>An <em>access sequence</em> is a sequence of accesses. The length of the sequence is the number of accesses it contains. In this case, each access is an access to an address. So that should help you decode what is meant by "an access sequence of cache block address".</p> <p>As far as solving the problem, it's yo...
735
question answering
Question Regarding Design Constraints in Software Engineering Exam
https://cs.stackexchange.com/questions/161912/question-regarding-design-constraints-in-software-engineering-exam
<p>I recently had a software engineering exam, and there's a particular question that's causing some confusion between my professor and me. I'd like to get some insights from the community to better understand this issue. If I can convince my professor I was right, I could get a higher grade.</p> <p>The Question:</p> <...
<p>I would argue that the answer is &quot;all of the above&quot;.</p> <ul> <li>Programming language and algorithms: is it worth the cost of a new compiler and associated tools to use the newest wiz-bang language, or do you make do with the language and tools you have already purchased? What algorithms will allow the a...
736
question answering
How to remember NFA&#39;s choice on a certain computation?
https://cs.stackexchange.com/questions/49755/how-to-remember-nfas-choice-on-a-certain-computation
<p>I'm working on solving the question answered at this page but with different values at the table, my alphabet is {a,b,c} <a href="https://cs.stackexchange.com/questions/1467/words-that-have-the-same-right-and-left-associative-product">Words that have the same right- and left-associative product</a></p> <p>Currently...
<p>Hint: Let the input be $x_1,\ldots,x_n$. As you mention, it is easy to compute the left-associative product $L_n$ "as you go": $L_{m+1} = L_m x_{m+1}$. The right-associative product recurrence has the wrong direction: $R_m = x_{m+1} R_{m+1}$. To cope with that, at each step you have to <em>guess</em> the value of $R...
737
question answering
Rational agent question from Russell and Norvig
https://cs.stackexchange.com/questions/14351/rational-agent-question-from-russell-and-norvig
<p>Question from <em>Artificial Intelligenge: A Modern Approach</em> by Russell and Norvig (Exercise 2.1).</p> <blockquote> <p>Suppose that the performance measure is concerned with just the first $T$ time steps of the environment and ignores everything thereafter. Show that a rational agent's action may depend ...
<p>This question is obvious as you told and its purpose is to ensure that the reader has understood a part of the chapter. You are right that the actions that the agent does will differ in the time period T. They will also differ after this period, because the agent's actions will have no value.</p> <p>One example ma...
738
question answering
Regular Language - Context Free Language
https://cs.stackexchange.com/questions/119254/regular-language-context-free-language
<p>I know this is not a question answer posting site but for the sake of explaining my doubt I will like to post a question</p> <blockquote> <p>Let <span class="math-container">$A$</span> be a <span class="math-container">$regular$</span> <span class="math-container">$language$</span> and <span class="math-container...
<p>Your second method to arrive at <span class="math-container">$\phi$</span> is bogus - consider the case where <span class="math-container">$B$</span> is the empty language. Where you are confused here is you are looking at the difference between the sets of all regular languages and all context free languages, inste...
739
question answering
Half precision floating point question -- smallest non-zero number
https://cs.stackexchange.com/questions/140115/half-precision-floating-point-question-smallest-non-zero-number
<p>There's a floating point question that popped up and I'm confused about the solution. It states that</p> <blockquote> <p>IEEE 754-2008 introduces half precision, which is a binary floating-point representation that uses 16 bits: 1 sign bit, 5 exponent bits (with a bias of 15) and 10 significand bits. This format use...
<p>In this example, <span class="math-container">$2^{-10}$</span> is the mantissa, and <span class="math-container">$2^{-14}$</span> is the exponent.</p> <p>For a fuller explanation of subnormal numbers in IEEE-754 floating point, see <a href="https://cs.stackexchange.com/questions/131754/how-to-represent-zero-as-float...
740
question answering
Is $k$-Clique NP-hard?
https://cs.stackexchange.com/questions/119801/is-k-clique-np-hard
<p>On my lecture note it was written that "Finding a clique of size <span class="math-container">$k$</span> in a graph is NP".</p> <p>Later in an example for reduction the following was written:</p> <p>"Assume we know how to answer "Is there a clique of size <span class="math-container">$k$</span> in a graph", then e...
741
question answering
Question about data path dependencies in a program
https://cs.stackexchange.com/questions/171698/question-about-data-path-dependencies-in-a-program
<p>I cannot understand solution to the problem 5.5 in &quot;<strong>Computer Systems: Programmers Perspective</strong>&quot;. I this chapter it cover microarchitecture based optimizations and data path dependency. As a reference it uses this reference machine: <a href="https://i.sstatic.net/bZHZVFpU.png" rel="nofollow ...
<blockquote> <p>We also need result from previous iteration and to calculate it we need 1 floating addition and 1 floating multiplication.</p> </blockquote> <p>Only the addition depends on the previous <code>result</code>.</p> <p>What happens here is that <code>a[i] * xpwr</code> is computed, and only <em>then</em> we ...
742
question answering
Why is it not possible to prove the equivalence of nondeterministic and deterministic Turing Machines the same way as for NFAs and DFAs?
https://cs.stackexchange.com/questions/114808/why-is-it-not-possible-to-prove-the-equivalence-of-nondeterministic-and-determin
<p>I found en excercise asking this question. I know that for proving the equivalence of NFAs and DFAs we can use the conversion through subsets, and that for proving the equivalence of nondeterministic TMs and deterministic ones we can build a 3-tape deterministic TM M which emulates the steps of a given nondeterminis...
743
question answering
A Question relating to a Turing Machine with a useless state
https://cs.stackexchange.com/questions/636/a-question-relating-to-a-turing-machine-with-a-useless-state
<p>OK, so here is a question from a past test in my Theory of Computation class:</p> <blockquote> <p>A useless state in a TM is one that is never entered on any input string. Let $$\mathrm{USELESS}_{\mathrm{TM}} = \{\langle M, q \rangle \mid q \text{ is a useless state in }M\}.$$ Prove that $\mathrm{USELESS}_{\m...
<p>This is clearly reducible from the Halting Problem. If a machine $M$ does not stop on input $x$ then any final state is "useless". Given an input $M,x$ for the Halting problem, it is easy to construct $M_x$ that halts on every input (thus its final state is not useless) if and only if $M$ halts on $x$. That way you ...
744
question answering
Need help with previous &quot;Automata / Theory Of Computation&quot; exam question
https://cs.stackexchange.com/questions/119421/need-help-with-previous-automata-theory-of-computation-exam-question
<p>I passed by this question in a previous exam while studying for the "Automata / Theory Of Computation" and I am struggling to find answer. I would appreciate it if someone can help me with it:</p> <p>This is the question:</p> <p>a)On the basis of what was covered in class, draw the Venn diagram representing the fo...
<p>The relevant set-theoritic relations are <span class="math-container">$$ \mathsf{REXP} = \mathsf{DFSA} = \mathsf{NFSA} \subsetneq \mathsf{CFG} = \mathsf{PDA}. $$</span> The corresponding Venn diagram consists of two circles, one inside the other.</p>
745
question answering
L = { &lt;M&gt;, M is a DFA accepting all strings except finitely many
https://cs.stackexchange.com/questions/88036/l-m-m-is-a-dfa-accepting-all-strings-except-finitely-many
<p>Is the $L$ = { $&lt;M&gt;$, $M$ is a DFA accepting all strings except finitely many. } decidable ?<br><br> I am sort of confused about the question - what exactly does $M$ accept. How are those finitely many strings look like for a particular $DFA$? It is known that $DFA$ accepts infinite number of strings if it acc...
<p>It is indeed decidable, but your solution is not quite correct.</p> <p>To restate the problem, we're given an encoding $\langle M\rangle$ of a DFA $M$, and we want to decide whether accepts every possible string except a very small (finite) number of them. So for each DFA encoding in this language $L$, there's an a...
746
question answering
Question regarding coin change algorithm (DP and greedy)
https://cs.stackexchange.com/questions/64900/question-regarding-coin-change-algorithm-dp-and-greedy
<p>The question goes something like this:</p> <p>Suppose you are living in a country where coins have values that are powers of p, V = [1, 3, 9, 27]. How do you think the dynamic programming and greedy approaches would compare?</p> <p>Intuitively I want to answer that DP will be faster because greedy runs the same nu...
<p>In terms of running time, the greedy algorithm is still going to be faster than the DP algorithm. DP will always produce the optimal solution regardless of values in V. Greedy, on the other hand, takes advantage of extra structure present in some value choices that allow it to effectively ignore possible ways of get...
747
question answering
Logic Question - Why is This an Implication?
https://cs.stackexchange.com/questions/21512/logic-question-why-is-this-an-implication
<p>I have a question about predicate logic. Suppose we have the following predicates:</p> <p>$\text{Study}(x,y)$: x studies y</p> <p>$\text{Comp}(x)$: x is a computing student</p> <p>I want to encode the following sentence in predicate logic: "Some, but not all computer students study logic."</p> <p>A potential ans...
<p>Because $\neg\forall x\,(\text{Comp}(x) \wedge \text{Study}(x,l))$ means "It is not true that every student is both a computing student and studying logic." In particular, that would be true if there is at least one student who is not a computing student, regardless of whether all computing students do or do not stu...
748
text generation
Second-order Markov text generation?
https://cs.stackexchange.com/questions/77465/second-order-markov-text-generation
<p>Looking at <a href="https://youtu.be/WyAtOqfCiBw?t=1m45s" rel="nofollow noreferrer">this</a> video starting at 1:45, the author claims to be using a second-order approximation for a Markov text generation. He has one letter which he outputs followed by another letter which tells him which state to go to - so in othe...
749
text generation
Phrase generation approaches
https://cs.stackexchange.com/questions/67772/phrase-generation-approaches
<p>In generating reports, sometimes there is a need to produce quite involved phrases in one of natural languages given numerical or boolean parameters.</p> <p>To get a feel of it, it is enough to take a look at <a href="https://stackoverflow.com/questions/8982163/how-do-i-tell-python-to-convert-integers-into-words">c...
<p>I've found a survey on <a href="https://arxiv.org/pdf/1703.09902.pdf" rel="nofollow noreferrer">natural-language generation approaches</a> by Albert Gatt, Emiel Krahmer, 2018. According to that, my question is about <em>linguistic realization</em>. And the paper mentions three most common ones:</p> <ul> <li>human-c...
750
text generation
Advice needed. NLP and ML. Where to start?
https://cs.stackexchange.com/questions/66309/advice-needed-nlp-and-ml-where-to-start
<p>Hi fellow computer scientists,</p> <p>I just began my journey to the world of ML and NLP so please bear with me. I'm hoping to find some guidance here. I would be very grateful if anyone could point me in the right direction (reading materials, lectures, specific algorithms, tools, etc.) for solving the following l...
<p>As far as I can see, your reading list lacks specific NLP introductions. A really good starting point is Dan Jurafsky and Chris Manning's Coursera course (for example here <a href="https://www.youtube.com/watch?v=nfoudtpBV68" rel="nofollow noreferrer">https://www.youtube.com/watch?v=nfoudtpBV68</a> ). This specifica...
751
text generation
How did the first computer model display text?
https://cs.stackexchange.com/questions/91344/how-did-the-first-computer-model-display-text
<p>I have a question ive not been able to explain, and I still cant find the answer looking through computer history. I want to know how the first letters were programmed into the first computer.</p> <p>Let me explain more..</p> <p>So when i research computer history they discuss the machines and how they work and wh...
752
text generation
How to implement a maximal munch lexical analyzer by simulating NFA or running DFA?
https://cs.stackexchange.com/questions/97374/how-to-implement-a-maximal-munch-lexical-analyzer-by-simulating-nfa-or-running-d
<p>I'm planning to implement a lexical analyzer by either simulating NFA or running DFA using the input text. The trouble is, the input may arrive in small chunks and the memory may not be enough to hold one very long token in the memory.</p> <p>Let's assume I have three tokens, "ab", "abcd" and "abce". The NFA I obta...
<p>There are two ways to handle this issue:</p> <ol> <li><p>The most common implementation (the one used in lex, flex and other similar scanner generators) is to always recall the last accept position and state (or accept code). When no more transitions are possible, the input is backed up to the last accept position ...
753
text generation
Is there any scenario whereby randomly shufflying a sequence improves it&#39;s compressibility?
https://cs.stackexchange.com/questions/114998/is-there-any-scenario-whereby-randomly-shufflying-a-sequence-improves-its-compr
<p>I'm performing some correlation assessment à la NIST <a href="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90B.pdf" rel="nofollow noreferrer">Recommendation for the Entropy Sources Used for Random Bit Generation</a>, &sect; 5.1. </p> <p>You take a test sequence and compress it with a standard ...
<p>I now think that it's because of this:-</p> <blockquote> <p>ZPAQ has 5 compression levels from fast to best. At all but the best level, it uses the statistics of the order-1 prediction table used for deduplication to test whether the input appears random. If so, it is stored <strong>without compression</strong> a...
754
text generation
Are there any neural NLG systems which don&#39;t generate in left-to-right order?
https://cs.stackexchange.com/questions/99987/are-there-any-neural-nlg-systems-which-dont-generate-in-left-to-right-order
<p>For a while, all classification tasks in natural language processing were based on simple RNN's, which operate in a very word-by-word order. Adding gating mechanisms increased ability to "look back", and the newer addition of context vectors which can train attention to different words during the task have made cla...
755
text generation
Generating graphs with partially overlapping cliques
https://cs.stackexchange.com/questions/146645/generating-graphs-with-partially-overlapping-cliques
<p>Currently, I am working on a research project where I will utilise reinforcement learning for the diversified top-<span class="math-container">$k$</span> clique search problem. To train the reinforcement learning algorithm, I need to generate graphs that have similar properties, such as average degree and overlappin...
756
text generation
What does it mean to be &quot;closed&quot; under beta reduction?
https://cs.stackexchange.com/questions/41051/what-does-it-mean-to-be-closed-under-beta-reduction
<p>I am reading the paper <a href="http://research.microsoft.com/en-us/um/people/akenn/sml/CompilingWithContinuationsContinued.pdf" rel="nofollow"><em>Compiling with Continuations, Continued</em></a>, and in section 2.4, <em>Comparison with ANF</em>, the author draws attention to the fact that ANF is not closed under b...
<p>The claim is that after applying β-reduction to an expression in A-normal form you can be left with an expression no longer in A-normal form.</p> <p>The only explicit definition I can find of A-normal form is not consistent with the definition Kennedy seems to be (implicitly) using in this paper. <a href="http://e...
757
text generation
Help understanding formal language notation
https://cs.stackexchange.com/questions/32347/help-understanding-formal-language-notation
<p>I am reading this text and it is making absolutely no sense to me. It as if it assumed I will understand. Not to mention the writer apparently had a book made and his grammar is poor. Some of the plain English sentences do not even make sense or have the letter s on the end of words where they should not be. please ...
<p>The problem seems to be that they assume you have a background in formal language theory. Here's the basics.</p> <ol> <li><p>$\Sigma$ is the symbol which is traditionally used for an alphabet. When you're talking about strings, you always have a finite set of symbols that can be in those strings. Here we use $\Sigm...
758
text generation
How is sound input and output data converted to use with machine learning networks?
https://cs.stackexchange.com/questions/11720/how-is-sound-input-and-output-data-converted-to-use-with-machine-learning-networ
<p>Suppose one has a couple of <em>.wav</em> files with English spoken words, multiple ones for each word, and for each such set there exists a transcription of their right output, the pronunciation as <em>ascii text</em>.</p> <p>As far as I know, machine learning neural networks use arrays of floats as input and outp...
<p>Probably the most common way to represent audio for speech recognition is using the <a href="http://en.wikipedia.org/wiki/Mel-frequency_cepstrum" rel="nofollow">Mel-frequency cepstrum</a> coefficients. If you're interested in finding out more about state of the art neural network based systems for speech recognition...
759
text generation
Computing the unique triangles and edges from vertex connectivity of a Delaunay triangulation
https://cs.stackexchange.com/questions/152993/computing-the-unique-triangles-and-edges-from-vertex-connectivity-of-a-delaunay
<p>I am currently studying triangular mesh generation in 2D and, in that connection, the Delaunay triangulation of a list of vertices <span class="math-container">$\{ v_1, v_2, ..., v_N \}$</span>. The divide and conquer algorithm of Lee &amp; Schachter (from their paper &quot;Two Algorithms for Constructing a Delaunay...
760
text generation
Local type argument synthesis when type variable does not appear in arguments
https://cs.stackexchange.com/questions/73831/local-type-argument-synthesis-when-type-variable-does-not-appear-in-arguments
<p>I am implementing the techniques described in the classic <a href="https://www.cis.upenn.edu/~bcpierce/papers/lti.pdf" rel="noreferrer">Local Type Inference</a> paper. Specifically, I am implementing the type argument synthesis algorithm from section 3.</p> <p>My algorithm seems to mostly work, but it doesn’t seem ...
<p>As a prelude, there is some terminological confusion in your question. The issue is about a type variable occurring in a result <em>type</em> of a function. This is fairly minor. A more serious one is when you say "my implementation happily infers the types of the above two functions to be ...". What functions? ...
761
text generation
How to transform an arbitrary graph into a fixed vector representation?
https://cs.stackexchange.com/questions/112767/how-to-transform-an-arbitrary-graph-into-a-fixed-vector-representation
<p>Actuality I work in computer vision, specifically on a problem known as "scene graph modeling." This problem aims to convert an image <span class="math-container">$I$</span> in a graph <span class="math-container">$G=(V,E)$</span> where the nodes <span class="math-container">$V$</span> represent the objects (and the...
762
text generation
Open Problem: Structural Learnability of Pseudo-Random Boolean Circuits
https://cs.stackexchange.com/questions/171777/open-problem-structural-learnability-of-pseudo-random-boolean-circuits
<p>I would like to propose an open problem at the intersection of computational complexity, pseudorandomness, and circuit theory. This problem has potential implications for cryptography, AI model analysis, and the theory of explainability in stochastic systems.</p> <p><strong>Informal formulation</strong></p> <p>Let u...
763
text generation
Will this algorithm always solve a constrained sudoku puzzle in quadratic time?
https://cs.stackexchange.com/questions/107183/will-this-algorithm-always-solve-a-constrained-sudoku-puzzle-in-quadratic-time
<h1>Constrained Puzzle Generation:</h1> <p>Let us say a sudoku puzzle is generated with the following procedure:</p> <ol> <li>Gather a sequence input of 9 unique numbers in the range <span class="math-container">$[1 .. 9]$</span>. Call it <span class="math-container">$S$</span>.</li> <li>Map <span class="math-contain...
<p>Let me start from correctness check, will this method always generate grids abiding sudoku rules?<br> In fact yes, your shift operator is simply circulant matrix, scattering boxes. Since circulant matrix always abide rules by row and column but not by box, you use permutation (scattering scheme), which now abide all...
764
text generation
Efficient n-choose-k random sampling
https://cs.stackexchange.com/questions/104930/efficient-n-choose-k-random-sampling
<p>Is there an efficient method of sampling an n-choose-k combination at random (with uniform probability, for example)?</p> <p>I have read <a href="https://cs.stackexchange.com/questions/79555">this question</a> but it asks for generations of all combinations, not combinations at random.</p> <p>I general I'm aware o...
<p>Here is the simplest algorithm, which is efficient when <span class="math-container">$k$</span> is much smaller than <span class="math-container">$n$</span> relatively.</p> <hr> <p>Input: two positive integers <span class="math-container">$n$</span> and <span class="math-container">$k$</span> with <span class="mat...
765
T5 model
T5 model custom vocabulary
https://stackoverflow.com/questions/62519413/t5-model-custom-vocabulary
<p>Is there a way to choose my custom vocabulary in T5-model while fine-tuning for a text summarization task?</p> <p>I tried using a sentencepiece model to create my custom tokenizer but the model predicted some tokens which was not present in my tokenizer and hence the tokenizer takes it as an unknown token.</p>
<p>It is okay to add few tokens but you can not be using a totally different vocabulary and fine-tuning at the same time! The pre-trained weights are trained with the pre-trained vocabulary :) If you change the vocabulary, the trained weights become meaningless and invalid! If you want to use another vocabulary you hav...
0
T5 model
Using the T5 model with huggingface&#39;s mask-fill pipeline
https://stackoverflow.com/questions/61408753/using-the-t5-model-with-huggingfaces-mask-fill-pipeline
<p>Does anyone know if it is possible to use the T5 model with hugging face's mask-fill pipeline? The below is how you can do it using the default model but i can't seem to figure out how to do is using the T5 model specifically? </p> <pre><code>from transformers import pipeline nlp_fill = pipeline('fill-mask') nlp_f...
1
T5 model
KeyError: &#39;target_text&#39; while training a t5 model using simple transformers
https://stackoverflow.com/questions/72880981/keyerror-target-text-while-training-a-t5-model-using-simple-transformers
<p>I am training a T5 model using Simple transformers and that is giving keyError:'target_text' what could be The probable cause of it and how can I solve this? here is my code</p> <pre><code> !pip install SimpleTransformers import logging import pandas as pd df=pd.read_csv('/content/Vastu - Sheet1 (4).csv',se...
2
T5 model
Error while converting google flan T5 model to onnx
https://stackoverflow.com/questions/78483209/error-while-converting-google-flan-t5-model-to-onnx
<p>I am looking to convert flan-T5 model downloaded from Hugging face into onnx format and make inference with the same.</p> <p>My input data is the <strong>symptoms of disease</strong> and expected output is the <strong>Disease name</strong></p> <pre><code>from transformers import AutoTokenizer, AutoModelForSeq2SeqLM ...
<p>Use <a href="https://huggingface.co/datasets/bakks/flan-t5-onnx" rel="nofollow noreferrer">https://huggingface.co/datasets/bakks/flan-t5-onnx</a> instead.</p> <p>And to convert the <code>google/flan-t5</code>, see <a href="https://huggingface.co/datasets/bakks/flan-t5-onnx/blob/main/exportt5.py" rel="nofollow nore...
3
T5 model
Output logits from T5 model for text generation purposes
https://stackoverflow.com/questions/73314467/output-logits-from-t5-model-for-text-generation-purposes
<p>I am using the T5 model found on Hugging Face for text summarization. How can I output the logits of the T5 model directly given a text input for generation purposes (not training)?</p> <p>I want to generate the outputs token by token so that I can calculate the entropy of each output token, respectively. It does no...
<p>You can use the forward function to get your logits, and apply argmax as such:</p> <pre class="lang-py prettyprint-override"><code>from transformers import AutoTokenizer, AutoModelForSeq2SeqLM import torch.nn.functional as F tokenizer = AutoTokenizer.from_pretrained(&quot;t5-small&quot;) model = AutoModelForSeq2Seq...
4
T5 model
Does Huggingface&#39;s T5 Model Vocabulary include English-only version?
https://stackoverflow.com/questions/61880247/does-huggingfaces-t5-model-vocabulary-include-english-only-version
<p>Does anyone know if HuggingFace's T5 model (small) comes with mono-language vocabulary? The T5 paper by Google indicates that their vocabulary is trained on English and 3 other languages. Is there a version of this vocabulary that contains English only vocabulary? </p>
<p>When looking at the publicly available <a href="https://s3.amazonaws.com/models.huggingface.co/bert/t5-small-config.json" rel="nofollow noreferrer">model card definition</a>, the HuggingFace T5-small also seems to contain the necessary translation tasks, which makes it a multi-lingual model. Note that the summarizat...
5
T5 model
Hugging Face T5 model that is not pre-trained and training it
https://stackoverflow.com/questions/74267006/hugging-face-t5-model-that-is-not-pre-trained-and-training-it
<p>I want to use the Hugging Face T5 model to do summarization but I want to train the model with my own dataset.</p> <p>How can I get the T5 model such that it has not been trained yet? And what steps do I need to take to train it?</p> <p>Currently I am look at this tutorial: <a href="https://huggingface.co/docs/trans...
6
T5 model
Using the encoder part only from T5 model
https://stackoverflow.com/questions/71788825/using-the-encoder-part-only-from-t5-model
<p>I want to build a classification model that needs only the encoder part of language models. I have tried Bert, Roberta, xlnet, and so far I have been successful.</p> <p>I now want to test the encoder part only from T5, so far, I found encT5 <a href="https://github.com/monologg/EncT5" rel="noreferrer">https://github....
<p>Load T5 encoder checkpoint only:</p> <pre><code>from transformers import T5EncoderModel T5EncoderModel._keys_to_ignore_on_load_unexpected = [&quot;decoder.*&quot;] auto_model = T5EncoderModel.from_pretrained(&quot;t5-base&quot;) </code></pre> <p>Note that T5 doesn't have CLS token so you should use another strategy ...
7
T5 model
How to use AllenNLP interpret on finetuned t5 model
https://stackoverflow.com/questions/69527860/how-to-use-allennlp-interpret-on-finetuned-t5-model
<p>I have trained a T5 model on a specific dataset for the purpose of keyword extraction. I wish to use Allen NLP Interpret to know various saliency mappings for the inputs given to my model. Where do I make changes such that I can use the package.</p>
<p>The AllenNLP guide has a chapter on interpreting models: <a href="https://guide.allennlp.org/interpret" rel="nofollow noreferrer">https://guide.allennlp.org/interpret</a></p> <p>Also, for custom models, here's an example: <a href="https://stackoverflow.com/questions/65806905/how-to-use-allen-nlp-interpret-on-custom-...
8
T5 model
T5 model generates short output
https://stackoverflow.com/questions/74981011/t5-model-generates-short-output
<p>I have fine-tuned the T5-base model (from hugging face) on a new task where each input and target are sentences of 256 words. The loss is converging to low values however when I use the <code>generate</code> method the output is always too short. I tried giving minimal and maximal length values to the method but it ...
<p>For whom it may concern, I found out the issue was with the <code>max_length</code> argument of the generation method. It limits the maximal number of tokens <strong>including</strong> the input tokens. In my case it was required to set <code>max_new_tokens=1024</code> instead of the argument provided in the questio...
9
T5 model
How to properly finetune t5 model
https://stackoverflow.com/questions/71607360/how-to-properly-finetune-t5-model
<p>I'm finetuning a t5-base model following <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/translation.ipynb#scrollTo=ZwZDgY-0DbrD" rel="nofollow noreferrer">this notebook</a>. However, the loss of both validation set and training set decreases very slowly. I changed the le...
<p>I think the metrics shown in the tutorial are for the already trained EN&gt;RO opus-mt model which was then fine-tuned. I don't see the before and after comparison of the metrics for it, so it is hard to tell how much of a difference that fine-tuning really made.</p> <p>You generally shouldn't expect the same result...
10
T5 model
Huggingface GPT2 and T5 model APIs for sentence classification?
https://stackoverflow.com/questions/62561471/huggingface-gpt2-and-t5-model-apis-for-sentence-classification
<p>I've successfully used the <a href="https://huggingface.co/transformers/model_doc/bert.html" rel="nofollow noreferrer">Huggingface Transformers BERT model</a> to do sentence classification using the <a href="https://huggingface.co/transformers/model_doc/bert.html#bertforsequenceclassification" rel="nofollow norefer...
<p>You need to use GPT2Model class to generate the sentence embeddings of the text. once you have the embeddings feed them to a Linear NN and softmax function to obtain the logits, below is a component for text classification using GPT2 I'm working on(still a work in progress, so I'm open to suggestions), it follows th...
11
T5 model
Making prediction from encoder and decoder of T5 model without using generate method
https://stackoverflow.com/questions/71049114/making-prediction-from-encoder-and-decoder-of-t5-model-without-using-generate-me
<p>I was working on the optimization of the T5 model I separated the model into encoder and decoder and converted them to ONNX using Nvidia TensorRT repo <a href="https://github.com/NVIDIA/TensorRT/tree/main/demo/HuggingFace" rel="nofollow noreferrer">https://github.com/NVIDIA/TensorRT/tree/main/demo/HuggingFace</a> b...
12
T5 model
How to freeze parts of T5 transformer model
https://stackoverflow.com/questions/71048521/how-to-freeze-parts-of-t5-transformer-model
<p>I know that T5 has K, Q and V vectors in each layer. It also has a feedforward network. I would like to freeze K, Q and V vectors and only train the feedforward layers on each layer of T5. I use Pytorch library. The model could be a wrapper for huggingface T5 model or a modified version of it. I know how to freeze a...
<p>I've adapted a solution based on <a href="https://discuss.huggingface.co/t/how-to-freeze-some-layers-of-bertmodel/917" rel="nofollow noreferrer">this discussion</a> from the Huggingface forums. Basically, you have to specify the names of the modules/pytorch layers that you want to freeze.</p> <p>In your particular c...
13
T5 model
HuggingFace - Why does the T5 model shorten sentences?
https://stackoverflow.com/questions/72882799/huggingface-why-does-the-t5-model-shorten-sentences
<p>I wanted to train the model for spell correction. I trained two models allegro/plt5-base with polish sentences and google/t5-v1_1-base with english sentences. Unfortunately, I don't know for what reason, but both models shorten the sentences. Example:</p> <pre><code>phrases = ['The name of the man who was kild was J...
<p>I have already managed to solve the problem. When generating the tokens with the model, the max_length parameter had to be added, as below:</p> <pre><code>translated = self._model.generate(**encoded, max_length=1024) </code></pre> <p>As a result, the model was no longer truncating sentences.</p>
14
T5 model
Question Answering with pre-trained model T5
https://stackoverflow.com/questions/71861922/question-answering-with-pre-trained-model-t5
<p>I want to use the pre-trained T5 model <a href="https://huggingface.co/docs/transformers/model_doc/t5" rel="nofollow noreferrer">https://huggingface.co/docs/transformers/model_doc/t5</a> on the task of Question Answering on the <a href="https://huggingface.co/datasets/boolq" rel="nofollow noreferrer">https://hugging...
<p>Wasn't the T5 model also trained on BoolQ which would make this difficult and kind of fishy to test/evaluate because the later test data would not really be unseen data for the model? You can see it listed in the <a href="https://huggingface.co/t5-base" rel="nofollow noreferrer">model card on huggingface</a> as well...
15
T5 model
What does the vocabulary of a pre-trained / fine-tuned T5 model look like?
https://stackoverflow.com/questions/77248165/what-does-the-vocabulary-of-a-pre-trained-fine-tuned-t5-model-look-like
<p>My question is regarding the pre-trained T5 models found on Huggingface. In either case of taking the fully-trained model, or after fine-tuning it, is there an API function for directly downloading the vocabulary?</p> <p>More specifically, the default <code>vocab_size</code> for T5 is 32128 (<a href="https://hugging...
<ul> <li><p>The T5 default vocabulary consists of 32,128 <strong>subword</strong> tokens (utilizing the SentencePiece tokenizer), not word tokens. Thus, it can generate a larger vocabulary than the specified 32,128.</p> </li> <li><p>&quot;hello&quot; and &quot;Hello&quot; are treated as different tokens because T5's to...
16
T5 model
How to use output from T5 model to replace masked tokens in input sequence
https://stackoverflow.com/questions/75977316/how-to-use-output-from-t5-model-to-replace-masked-tokens-in-input-sequence
<p>I'm working with the T5 model from the Hugging Face Transformers library and I have an input sequence with masked tokens that I want to replace with the output generated by the model. Here's the <a href="https://huggingface.co/docs/transformers/model_doc/t5#inference" rel="nofollow noreferrer">code</a>.</p> <pre><co...
<p>The t5 model considers tokens which begin with &lt;extra_id as potential mask tokens. As written in the <a href="https://huggingface.co/docs/transformers/model_doc/t5#training" rel="noreferrer">documentation</a></p> <p>&quot;Each sentinel token represents a unique mask token for this sentence and should start with &...
17
T5 model
Poor rouge metric on CNN DailyMail dataset for pretrained T5 model
https://stackoverflow.com/questions/76115668/poor-rouge-metric-on-cnn-dailymail-dataset-for-pretrained-t5-model
<p>I am trying to fine-tune a pre-trained T5 model on CNN/DailyMail dataset with the following code:</p> <pre class="lang-py prettyprint-override"><code>import torch import torch.nn as nn import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP from datasets import load_dataset fro...
18
T5 model
perform peft with lora on flan-t5 model causing no executable batch size error
https://stackoverflow.com/questions/77334292/perform-peft-with-lora-on-flan-t5-model-causing-no-executable-batch-size-error
<p>I'm trying to perform PEFT with LoRA. I'm using the Google flan-T5 base model. I'm using the Python code below. I'm running the code with an nvidia GPU with 8 GB of ram on Ubuntu server 18.04 LTS. In the Python code I'm loading the public dataset from huggingface. I've loaded the pre-trained flan-T5 model. I've set...
<p>Try removing the <code>auto_find_batch_size=True</code> in <code>TrainingArguments</code> and set batch size on your own</p>
19
T5 model
How to use architecture of T5 without pretrained model (Hugging face)
https://stackoverflow.com/questions/73700165/how-to-use-architecture-of-t5-without-pretrained-model-hugging-face
<p>I would like to study the effect of pre-trained model, so I want to test t5 model with and without pre-trained weights. Using pre-trained weights is straight forward, but I cannot figure out how to use the architecture of T5 from hugging face without the weights. I am using Hugging face with pytorch but open for dif...
<p><a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Model" rel="nofollow noreferrer">https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Model</a></p> <p>&quot;Initializing with a config file does not load the weights associated with the model, only the configuration.&quot;...
20
T5 model
Clarification on T5 Model Pre-training Objective and Denoising Process
https://stackoverflow.com/questions/78252488/clarification-on-t5-model-pre-training-objective-and-denoising-process
<p>I am currently developing a T5 model (encoder-decoder architecture) from scratch for educational purposes. While working on this project, I've encountered some confusion regarding the pre-training objective, specifically the <em>denoising objective</em>. I would like to clarify my understanding and have some questio...
<p>I think my interpretation is spot on, and that for large data sets, the model will understand that the Sentinels indicate the missing parts.</p>
21
T5 model
while exporting T5 model to onnx using fastT5 getting &quot;RuntimeError:output with shape [5, 8, 1, 2] doesn&#39;t match the broadcast shape [5, 8, 2, 2]&quot;
https://stackoverflow.com/questions/66693724/while-exporting-t5-model-to-onnx-using-fastt5-getting-runtimeerroroutput-with
<p>i'm trying to convert T5 model to onnx using the <a href="https://github.com/Ki6an/fastT5" rel="nofollow noreferrer">fastT5</a> library, but getting an error while running the following code</p> <pre><code>from fastT5 import export_and_get_onnx_model from transformers import AutoTokenizer model_name = 't5-small' mo...
<p>I've checked the repository, it looks like a known issue as reported here : <a href="https://github.com/Ki6an/fastT5/issues/1" rel="nofollow noreferrer">https://github.com/Ki6an/fastT5/issues/1</a></p> <p>Developer of the library has posted a solution and created a notebook file here: <a href="https://colab.research...
22
T5 model
Generating partial string as output after fine-tuning T5 model
https://stackoverflow.com/questions/79619113/generating-partial-string-as-output-after-fine-tuning-t5-model
<p>I'm using fine-tuned T5 model for performing spell checks in my dataset of consisting of reviews. However, I'm facing an issue where the model when performing spell checks does not give entire string as an output or sometimes repeats the phrases of the given review. It is not in large amounts but there do exists som...
<p>According to your two problems:</p> <ol> <li><p><strong>performing spell checks does not give entire string as an output</strong></p> </li> <li><p><strong>sometimes repeats the phrases of the given review</strong></p> </li> </ol> <p>I think you can adjust two arguments ( max_length, no_repeat_ngram_size ) for model....
23
T5 model
Abstractive Text summarization using T5 pre-trained model
https://stackoverflow.com/questions/67345611/abstractive-text-summarization-using-t5-pre-trained-model
<p>Hello I'm using t5 pretrained abstractive summarization how I can evaluate the summary output accuracy IN short how much percent my model are accurate</p>
<p>You could use ROUGE Metric as its metric for automatic summarization evaluation.</p> <p><a href="https://pypi.org/project/rouge-metric/" rel="nofollow noreferrer">https://pypi.org/project/rouge-metric/</a></p>
24
T5 model
TypeError: &#39;DataLoader&#39; object is not subscriptable T5 model
https://stackoverflow.com/questions/78525690/typeerror-dataloader-object-is-not-subscriptable-t5-model
<p>I'm trying to train my model using the following commands:</p> <pre><code>import numpy as np import pandas as pd import os import pandas as pd import tensorflow as tf from transformers import AutoTokenizer, T5ForConditionalGeneration, T5Config # IMPORT REQUIRED DATASET path = &quot;/content/train_set.csv&quot; pat...
25
T5 model
Determining the probability of a sequence generated by T5 model by HuggingFace
https://stackoverflow.com/questions/75028507/determining-the-probability-of-a-sequence-generated-by-t5-model-by-huggingface
<p>I am using T5-Large by HuggingFace for inference. Given a premise and a hypothesis, I need to determine whether they are related or not. So, if I feed a string <code>&quot;mnli premise: This game will NOT open unless you agree to them sharing your information to advertisers. hypothesis: Personal data disclosure is d...
<p>What you get as the scores are output token distributions before the softmax, so-called logits. You can get the probabilities of generated tokens by normalizing the logits and taking respective token ids. You can get them from the field <code>sequences</code> from what the <code>generate</code> method returns.</p> <...
26
T5 model
Modifying T5 for sequence labelling
https://stackoverflow.com/questions/69800263/modifying-t5-for-sequence-labelling
<p>I am trying to modify the T5-model as a sequence labelling task (to do NER). I create my model class by taking the last hidden states of the T5-model and add a linear layer with 3 out-features (for simple IOB-tags). Here is my model class:</p> <pre><code>class Seq2SeqTokenCLS(nn.Module): def __init__(self): ...
27
T5 model
AWS Sagemaker T5 or huggingface Model training issue
https://stackoverflow.com/questions/75055543/aws-sagemaker-t5-or-huggingface-model-training-issue
<p>I am trying to train a t5 conditional Generation model in Sagemaker, its running fine when I am passing the arguments directly in notebook but its not learning anything when I am passing estimator and train.py script, I followed the documentation provided by hugging face as well as AWS. But still we are facing issue...
<p>Check Amazon CloudWatch logs to be able to tell what took place during training (train.py stdout/stderr). This <a href="https://github.com/aws-samples/amazon-sagemaker-training-jobs-benchmarks/blob/main/utilities/download_sagemaker_job_logs.py" rel="nofollow noreferrer">utility</a> can help with downloading logs to ...
28
T5 model
Problem with custom metric for custom T5 model
https://stackoverflow.com/questions/76199989/problem-with-custom-metric-for-custom-t5-model
<p>I have created a custom dataset and trained on it a custom <code>T5ForConditionalGeneration</code> model that predicts solutions to quadratic equations like this:</p> <p>Input: <code>&quot;4*x^2 + 4*x + 1&quot;</code> Output: <code>D = 4 ^ 2 - 4 * 4 * 1 4 * 1 4 * 1 4 * 1 4 * 1 4</code></p> <p>I need to get accuracy ...
<p>It seems like the task you're trying to achieve is some sort of &quot;translation&quot; task so the most appropriate model is to use the <code>AutoModelForSeq2SeqLM</code>.</p> <p>And in the case of unspecified sequence, it might be more appropriate to use</p> <ul> <li>BLEU / ChrF or newer neural-based metrics for t...
29
T5 model
Google&#39;s flan-t5 models are not loading on HuggingFaceHub through Langchain
https://stackoverflow.com/questions/76209003/googles-flan-t5-models-are-not-loading-on-huggingfacehub-through-langchain
<p>I am trying to replicate the example code provided on Langchain website (<a href="https://python.langchain.com/en/latest/modules/models/llms/integrations/huggingface_hub.html" rel="nofollow noreferrer">link here</a>) but I am getting the following error whether I run it on Google colab or locally:</p> <p><strong>HfH...
<p>Use the following model: &quot;google/flan-t5-xxl&quot;</p>
30
T5 model
How to get reproducible results of T5 transformer model
https://stackoverflow.com/questions/64839614/how-to-get-reproducible-results-of-t5-transformer-model
<p>I'm trying to get reproducible results of T5 transformer model:</p> <pre><code>import torch from transformers import T5ForConditionalGeneration,T5Tokenizer def set_seed(seed): torch.manual_seed(seed) if torch.cuda.is_available(): torch.cuda.manual_seed_all(seed) set_seed(42) t5model = T5ForConditionalGen...
<p>You need to reload the state_dict of your model to produce every time the same output.</p> <p>What happens here, is that the T5 model initialization is calling the pytorch random number generator. That means, every time you run the following code, you will get the same output:</p> <pre class="lang-py prettyprint-ove...
31
T5 model
Why is unnormalized input added to output in Huggingface T5 model?
https://stackoverflow.com/questions/76760152/why-is-unnormalized-input-added-to-output-in-huggingface-t5-model
<p>In the T5 Hugging face code (see for instance <a href="https://github.com/huggingface/transformers/blob/main/src/transformers/models/t5/modeling_t5.py#L341C38-L341C38" rel="nofollow noreferrer">this</a>), it seems that Input is &quot;never normalized&quot;, in the following sense : each component outputs : <code>inp...
<p>T5 uses residual connections/skip connections where the input to a layer/group is added to the output of that layer. This is done to avoid vanishing gradient problems-- where the gradients of the loss function become very small as they get backpropagated through layers of the network. this makes the network difficul...
32
T5 model
How can we optimize and quantize fine-tune model of t5-grammar-correction, like pszemraj/t5-v1_1-base-ft-jflAUG, pszemraj/grammar-synthesis-base,
https://stackoverflow.com/questions/73163013/how-can-we-optimize-and-quantize-fine-tune-model-of-t5-grammar-correction-like
<p>when I use fastt5 library to convert t5-base fine-tune models like &quot;<strong>pszemraj/t5-v1_1-base-ft-jflAUG</strong>&quot;, &quot;<strong>pszemraj/grammar-synthesis-base</strong>&quot;, fastt5 library <a href="https://i.sstatic.net/YFXQW.png" rel="nofollow noreferrer">Image of error</a> <strong>show tuple index...
33