小编Ven*_*ath的帖子

找不到满足要求的版本 <every package> ,没有匹配的发行版

在 Windows 上,我无法安装以下任何软件包:numpy、matplotlib、skimage、...

我的python版本是2.7

每次都会出现同样的错误:

找不到满足 scikit-image 要求的版本(来自版本:)未找到 scikit-image 的匹配发行版

我尝试考虑“abce”要求,但没有成功。

非常感谢你对我的帮助

windows requirements pip scikit-image

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

运行时错误:张量 a (4000) 的大小必须与非单维 1 处的张量 b (512) 的大小匹配

我正在尝试为文档分类构建模型。我正在BERTPyTorch.

我得到了带有以下代码的 bert 模型。

bert = AutoModel.from_pretrained('bert-base-uncased')
Run Code Online (Sandbox Code Playgroud)

这是训练的代码。

for epoch in range(epochs):
 
    print('\n Epoch {:} / {:}'.format(epoch + 1, epochs))

    #train model
    train_loss, _ = modhelper.train(proc.train_dataloader)

    #evaluate model
    valid_loss, _ = modhelper.evaluate()

    #save the best model
    if valid_loss < best_valid_loss:
        best_valid_loss = valid_loss
        torch.save(modhelper.model.state_dict(), 'saved_weights.pt')

    # append training and validation loss
    train_losses.append(train_loss)
    valid_losses.append(valid_loss)

    print(f'\nTraining Loss: {train_loss:.3f}')
    print(f'Validation Loss: {valid_loss:.3f}')
Run Code Online (Sandbox Code Playgroud)

这是我的 train 方法,可通过 object 访问modhelper

def train(self, train_dataloader):
    self.model.train()
    total_loss, total_accuracy = 0, 0
    
    # …
Run Code Online (Sandbox Code Playgroud)

python deep-learning pytorch bert-language-model huggingface-transformers

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

无法解析 TabLayout

我试图在我的项目中使用 TabLayout 但我无法在我的项目中导入 TabLayout 类请帮助我。这是代码。

构建.gradle

 dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation "com.google.android.material:material:1.0.0"
Run Code Online (Sandbox Code Playgroud)

}

我还通过引用上一个问题添加了 android.material:material:1.0.0" ,但它对我不起作用。

这是我的 xml 文件。

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/white_grey_border_top">


        </android.support.design.widget.TabLayout>



    </android.support.design.widget.AppBarLayout>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

实际上,我正在学习 youtube 上的教程,它对他有用,但对我不起作用。

这是我的java类。

package Home;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TabLayout; //TabLayout showing red color.`enter code 
here`

import com.example.footag.R;

public class HomeActivity extends AppCompatActivity …
Run Code Online (Sandbox Code Playgroud)

android

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