小编Han*_*ith的帖子

GPT-2的“提示”中可以输入多少个字符

我正在使用github上的 OpenAI GPT-2 模型

我认为 top_k 参数决定了采样的令牌数量。这也是决定可以给出多大提示的参数吗?

如果top_k = 40,提示符可以有多大?

python nlp openai-api gpt-2

5
推荐指数
1
解决办法
6214
查看次数

使用“componentDidMount()”重定向:问题(反应)

我有一些有效的代码。它立即将用户从/test页面重新路由到FinishedPaying页面。是这样的:

class Test extends Component {
  renderRedirect = () => {
      return <Redirect to="/FinishedPaying" />;
  };
  componentDidMount() {
    this.renderRedirect();
  }
...
Run Code Online (Sandbox Code Playgroud)

以下代码用于发送Paypal交易,然后将用户路由到/FinishedPaying页面。所有其他逻辑都按预期工作:

export default class Pay extends React.Component {
  state = {
    userInput: ""
  };
  renderRedirect = () => {
      return (
        <Redirect
          to="/FinishedPaying"
          userInput={this.state.userInput}
        />
      );
  };
  componentDidMount() {
    this.setState({ userInput: this.props.userInput });
    this.renderRedirect();
  }

  render() {
    const onSuccess = payment => {
      axios
        .post(
          "http://amazonaws.com:3000/ethhash",
          {
            userInput: this.props.userInput,
          }
        ) …
Run Code Online (Sandbox Code Playgroud)

redirect reactjs react-router-dom

2
推荐指数
1
解决办法
1万
查看次数

如何使用文件对象设置状态

我有一个需要放入状态的文件对象。我尝试这样做的原因是它被提供作为重新渲染 DOM 的可能解决方案,以便清除 FileReader() 中的值。这是当前线程源自的链接

节点“加密”SHA256 散列模型行为不正常

我将在此处放置一个精简的 React 组件,以便您可以看到发生了什么。

import React, { Component } from "react";

class SearchPage extends Component {
  constructor(props) {
    super(props);
    this.state = {
      files: []
    };
  }

  onChange(e) {
    let files = e.target.files;
    this.setState({ files: files[0] });
    console.log(files[0]);
    console.log(this.state.files)
  }

  render() {
    return (
        <div onSubmit={this.onFormSubmit}>
          <input type="file" name="file" onChange={e => this.onChange(e)} />
        </div>
    );
  }
}

export default SearchPage;
Run Code Online (Sandbox Code Playgroud)

console.log(files[0]} 给出了这样的东西:

File(1) {name: "1.txt", lastModified: 1549429792266, lastModifiedDate: Tue Feb 05 2019 22:09:52 GMT-0700 (Mountain …
Run Code Online (Sandbox Code Playgroud)

state reactjs

1
推荐指数
1
解决办法
4319
查看次数

标签 统计

reactjs ×2

gpt-2 ×1

nlp ×1

openai-api ×1

python ×1

react-router-dom ×1

redirect ×1

state ×1